home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / PAGEFILE.VB_ / pagefile.vbs
Encoding:
Text File  |  2003-02-21  |  199.5 KB  |  3,942 lines

  1. '******************************************************************************
  2. '*
  3. '* Copyright (c) Microsoft Corporation. All rights reserved.
  4. '*
  5. '* Module Name:    PAGEFILECONFIG.vbs
  6. '*
  7. '* Abstract:       Enables an administrator to display and configure
  8. '*                 a systems Virtual Memory paging file settings.
  9. '*
  10. '*
  11. '******************************************************************************
  12.  
  13. OPTION EXPLICIT
  14.  
  15. ON ERROR RESUME NEXT
  16. Err.Clear
  17.  
  18. '******************************************************************************
  19. ' Start of Localization Content
  20. '******************************************************************************
  21.  
  22. ' Valid volume pattern [ a,b drives are invalid ]
  23. CONST L_VolumePatternFormat_Text             = "^([b-zB-Z]:|\*)$"
  24.  
  25. ' constants for showresults
  26. CONST L_Na_Text                              = "N/A"
  27. CONST L_MachineName_Text                     = "System Name"
  28. CONST L_User_Text                            = "User"
  29. CONST L_Password_Text                        = "Password"
  30. CONST L_Intsize_Text                         = "Initial Size"
  31. CONST L_Maxsize_Text                         = "Maximum Size"
  32. CONST L_Volume_Text                          = "Volume Name"
  33. CONST L_Format_Text                          = "Format"
  34.  
  35. ' the column headers used in the output display
  36. CONST L_ColHeaderHostname_Text               = "Host Name"
  37. CONST L_ColHeaderDrive_Text                  = "Drive/Volume"
  38. CONST L_ColHeaderVolumeLabel_Text            = "Volume Label"
  39. CONST L_ColHeaderFileName_Text               = "Location\File Name"
  40. CONST L_ColHeaderInitialSize_Text            = "Initial Size"
  41. CONST L_ColHeaderMaximumSize_Text            = "Maximum Size"
  42. CONST L_ColHeaderCurrentSize_Text            = "Current Size"
  43. CONST L_ColHeaderPageFileStatus_Text         = "Page File Mode"
  44. CONST L_ColHeaderFreeSpace_Text              = "Total Free Space"
  45. CONST L_ColHeaderTotalMinimumSize_Text       = "Total (All Drives): Minimum Size"
  46. CONST L_ColHeaderTotalRecommendedSize_Text   = "Total (All Drives): Recommended Size"
  47. CONST L_ColHeaderTotalSize_Text              = "Total (All Drives): Currently Allocated"
  48.  
  49.  
  50. ' Maximum Column Header Lengths used to display various fields.
  51. ' Localization team can adjust these columns to fit the localized strings.
  52.  
  53. ' constants for data lengths for ShowResults (15,13,13,19,20,20,20,22)
  54. CONST L_CONST_HOSTNAME_Length_Text          = 15
  55. CONST L_CONST_DRIVENAME_Length_Text         = 19
  56. CONST L_CONST_VOLLABEL_Length_Text          = 17
  57. CONST L_CONST_PAGEFILENAME_Length_Text      = 19
  58. CONST L_CONST_INTSIZE_Length_Text           = 20
  59. CONST L_CONST_MAXSIZE_Length_Text           = 20
  60. CONST L_CONST_CURRENTSIZE_Length_Text       = 20
  61. CONST L_CONST_FREESPACE_Length_Text         = 22
  62. CONST L_ColHeaderPageFileStatusLength_Text  = 20
  63.  
  64.  
  65. ' constants for data lengths for ShowResults (15,33,37,40)
  66. CONST L_CONST_TOTALMINSIZE_Length_Text      = 33
  67. CONST L_CONST_TOTALRECSIZE_Length_Text      = 37
  68. CONST L_CONST_TOTALSIZE_Length_Text         = 40
  69.  
  70.  
  71. ' user reply for the warning messages
  72. CONST L_UserReplyYes_Text                    = "y"
  73. CONST L_UserReplyNo_Text                     = "n"
  74.  
  75. 'Constants for indication of page file status
  76. CONST L_CONST_System_Managed_Text            = "System Managed"
  77. CONST L_Custom_Text                          = "Custom"
  78.  
  79. ' constants for CScript usage
  80. CONST L_UseCscript1_ErrorMessage             = "This script should be executed from the command prompt using CSCRIPT.EXE."
  81. CONST L_UseCscript2_ErrorMessage             = "For example: CSCRIPT  %windir%\System32\PAGEFILECONFIG.vbs <arguments>"
  82. CONST L_UseCscript3_ErrorMessage             = "To set CScript as the default application to run .vbs files, run the following:"
  83. CONST L_UseCscript4_ErrorMessage             = "       CSCRIPT //H:CSCRIPT //S"
  84. CONST L_UseCscript5_ErrorMessage             = "You can then run ""%windir%\System32\PAGEFILECONFIG.vbs <arguments>"" without preceding the script with CSCRIPT."
  85.  
  86. ' common constants for showing help for all the options
  87. CONST L_UsageDescription_Text                = "Description:"
  88. CONST L_UsageParamList_Text                  = "Parameter List:"
  89. CONST L_UsageExamples_Text                   = "Examples:"
  90. CONST L_UsageMachineName_Text                = "    /S    system           Specifies the remote system to connect to."
  91. CONST L_UsageUserNameLine1_Text              = "    /U    [domain\]user    Specifies the user context under which"
  92. CONST L_UsageUserNameLine2_Text              = "                           the command should execute."
  93. CONST L_UsagePasswordLine1_Text              = "    /P    password         Specifies the password for the given"
  94. CONST L_UsagePasswordLine2_Text              = "                           user context."
  95.  
  96. ' constants for showing help
  97. CONST L_ShowUsageLine02_Text                 = "PAGEFILECONFIG.vbs /parameter [arguments]"
  98. CONST L_ShowUsageLine05_Text                 = "    Enables an administrator to display and configure a system's "
  99. CONST L_ShowUsageLine06_Text                 = "    paging file Virtual Memory settings."
  100. CONST L_ShowUsageLine08_Text                 = "Parameter List:"
  101. CONST L_ShowUsageLine09_Text                 = "    /Change    Changes a system's existing paging file"
  102. CONST L_ShowUsageLine10_Text                 = "               Virtual Memory settings."
  103. CONST L_ShowUsageLine12_Text                 = "    /Create    Creates/Adds an additional ""Paging File"" to a system."
  104. CONST L_ShowUsageLine14_Text                 = "    /Delete    Deletes a ""Paging File"" from a system."
  105. CONST L_ShowUsageLine16_Text                 = "    /Query     Displays a system's paging file"
  106. CONST L_ShowUsageLine17_Text                 = "               Virtual Memory settings."
  107. CONST L_ShowUsageLine19_Text                 = "Examples:"
  108. CONST L_ShowUsageLine20_Text                 = "    PAGEFILECONFIG.vbs"
  109. CONST L_ShowUsageLine21_Text                 = "    PAGEFILECONFIG.vbs /?"
  110. CONST L_ShowUsageLine22_Text                 = "    PAGEFILECONFIG.vbs /Change /?"
  111. CONST L_ShowUsageLine23_Text                 = "    PAGEFILECONFIG.vbs /Create /?"
  112. CONST L_ShowUsageLine24_Text                 = "    PAGEFILECONFIG.vbs /Delete /?"
  113. CONST L_ShowUsageLine25_Text                 = "    PAGEFILECONFIG.vbs /Query  /?"
  114.  
  115. ' constants for showing help for /Change option
  116. CONST L_ShowChangeUsageLine02_Text           = "PAGEFILECONFIG.vbs /Change [/S system [/U username [/P password]]]"
  117. CONST L_ShowChangeUsageLine03_Text           = "                   { { [/I initialsize] [/M maximumsize] } | { /SYS } }"
  118. CONST L_ShowChangeUsageLine04_Text           = "                   /VO volume1 [/VO volume2 [... [/VO volumeN]]]"
  119. CONST L_ShowChangeUsageLine07_Text           = "    Changes an existing paging file's Virtual Memory Settings."
  120. CONST L_ShowChangeUsageLine18_Text           = "    /I    initialsize      Specifies the new initial size (in MB)"
  121. CONST L_ShowChangeUsageLine19_Text           = "                           to use for the paging file specified."
  122. CONST L_ShowChangeUsageLine21_Text           = "    /M    maximumsize      Specifies the new maximum size (in MB)"
  123. CONST L_ShowChangeUsageLine22_Text           = "                           to use for the paging file specified."
  124. CONST L_ShowChangeUsageLine24_Text           = "    /SYS  systemmanaged    Specifies that the page file has to "
  125. CONST L_ShowChangeUsageLine25_Text           = "                           be managed by the system."
  126. CONST L_ShowChangeUsageLine27_Text           = "    /VO   volumeletter     Specifies the local drive who's paging"
  127. CONST L_ShowChangeUsageLine28_Text           = "                           file settings need to be changed. Specify"
  128. CONST L_ShowChangeUsageLine29_Text           = "                           '*' to select all the local drives."
  129. CONST L_ShowChangeUsageLine30_Text           = "                           Example: ""C:"" or ""*"""
  130. CONST L_ShowChangeUsageLine33_Text           = "    PAGEFILECONFIG.vbs /Change /?"
  131. CONST L_ShowChangeUsageLine34_Text           = "    PAGEFILECONFIG.vbs /Change /M 400 /VO c:"
  132. CONST L_ShowChangeUsageLine35_text           = "    PAGEFILECONFIG.vbs /Change /VO c: /SYS"
  133. CONST L_ShowChangeUsageLine36_Text           = "    PAGEFILECONFIG.vbs /Change /S system /U user /M 400 /VO c:"
  134. CONST L_ShowChangeUsageLine37_Text           = "    PAGEFILECONFIG.vbs /Change /S system /U user /I 20 /VO *"
  135. CONST L_ShowChangeUsageLine38_Text           = "    PAGEFILECONFIG.vbs /Change /S system /U user /P password /I 200"
  136. CONST L_ShowChangeUsageLine39_Text           = "                       /M 500 /VO c: /VO d:"
  137.  
  138. ' constants for showing help for /Create option
  139. CONST L_ShowCreateUsageLine02_Text           = "PAGEFILECONFIG.vbs /Create [/S system [/U username [/P password]]]"
  140. CONST L_ShowCreateUsageLine03_Text           = "                   { {/I initialsize /M maximumsize} | { /SYS } }"
  141. CONST L_ShowCreateUsageLine04_Text           = "                   /VO volume1 [/VO volume2 [... [/VO volumeN]]]"
  142. CONST L_ShowCreateUsageLine07_Text           = "    Creates/Adds an additional ""Paging File"" to a system."
  143. CONST L_ShowCreateUsageLine18_Text           = "    /I    initialsize      Specifies the initial size (in MB) to use"
  144. CONST L_ShowCreateUsageLine19_Text           = "                           for the paging file being created."
  145. CONST L_ShowCreateUsageLine21_Text           = "    /M    maximumsize      Specifies the maximum size (in MB) to use"
  146. CONST L_ShowCreateUsageLine22_Text           = "                           for the paging file being created."
  147. CONST L_ShowCreateUsageLine24_Text           = "    /SYS  systemmanaged    Specifies that the page file has to "
  148. CONST L_ShowCreateUsageLine25_Text           = "                           be managed by the system."
  149. CONST L_ShowCreateUsageLine27_Text           = "    /VO   volumeletter     Specifies the local drive on which the"
  150. CONST L_ShowCreateUsageLine28_Text           = "                           paging file has to be created. Specify '*'"
  151. CONST L_ShowCreateUsageLine29_Text           = "                           to select all the local drives."
  152. CONST L_ShowCreateUsageLine30_Text           = "                           Example: ""C:"" or ""*"""
  153. CONST L_ShowCreateUsageLine33_Text           = "    PAGEFILECONFIG.vbs /Create /?"
  154. CONST L_ShowCreateUsageLine34_Text           = "    PAGEFILECONFIG.vbs /Create /I 140 /M 300 /VO d:"
  155. CONST L_ShowCreateUsageLine35_Text           = "    PAGEFILECONFIG.VBS /Create /VO c: /SYS"
  156. CONST L_ShowCreateUsageLine36_Text           = "    PAGEFILECONFIG.vbs /Create /S system /U user /I 150 /M 300 /VO d:"
  157. CONST L_ShowCreateUsageLine37_Text           = "    PAGEFILECONFIG.vbs /Create /S system /U user /I 50 /M 200 /VO *"
  158. CONST L_ShowCreateUsageLine38_Text           = "    PAGEFILECONFIG.vbs /Create /S system /U user /P password /I 100"
  159. CONST L_ShowCreateUsageLine39_Text           = "                       /M 600 /VO d: /VO e: /VO f:"
  160.  
  161. ' constants for showing help for /Delete option
  162. CONST L_ShowDeleteUsageLine02_Text           = "PAGEFILECONFIG.vbs /Delete [/S system [/U username [/P password]]]"
  163. CONST L_ShowDeleteUsageLine03_Text           = "                   /VO volume1 [/VO volume2 [... [/VO volumeN]]]"
  164. CONST L_ShowDeleteUsageLine06_Text           = "    Deletes paging file(s) from a system."
  165. CONST L_ShowDeleteUsageLine17_Text           = "    /VO   volumeletter     Specifies the local drive who's paging"
  166. CONST L_ShowDeleteUsageLine18_Text           = "                           file has to be deleted."
  167. CONST L_ShowDeleteUsageLine19_Text           = "                           Example: ""C:"""
  168. CONST L_ShowDeleteUsageLine22_Text           = "    PAGEFILECONFIG.vbs /Delete /?"
  169. CONST L_ShowDeleteUsageLine23_Text           = "    PAGEFILECONFIG.vbs /Delete /VO d:"
  170. CONST L_ShowDeleteUsageLine24_Text           = "    PAGEFILECONFIG.vbs /Delete /S system /U user /VO d: /VO e:"
  171. CONST L_ShowDeleteUsageLine25_Text           = "    PAGEFILECONFIG.vbs /Delete /S system /U user /P password /VO d:"
  172.  
  173. ' constants for showing help for /Query option
  174. CONST L_ShowQueryUsageLine02_Text            = "PAGEFILECONFIG.vbs /Query [/S system [/U username [/P password]]]"
  175. CONST L_ShowQueryUsageLine03_Text            = "                   [/FO format] [/NH]"
  176. CONST L_ShowQueryUsageLine06_Text            = "    Displays a system's paging file Virtual Memory settings."
  177. CONST L_ShowQueryUsageLine17_Text            = "    /FO   format           Specifies the format in which the output"
  178. CONST L_ShowQueryUsageLine18_Text            = "                           is to be displayed."
  179. CONST L_ShowQueryUsageLine19_Text            = "                           Valid values: ""TABLE"", ""LIST"", ""CSV""."
  180. CONST L_ShowQueryUsageLine21_Text            = "    /NH                    Specifies that the ""Column Header"" should"
  181. CONST L_ShowQueryUsageLine22_Text            = "                           not be displayed in the output."
  182. CONST L_ShowQueryUsageLine25_Text            = "    PAGEFILECONFIG.vbs"
  183. CONST L_ShowQueryUsageLine26_Text            = "    PAGEFILECONFIG.vbs /Query"
  184. CONST L_ShowQueryUsageLine27_Text            = "    PAGEFILECONFIG.vbs /Query /?"
  185. CONST L_ShowQueryUsageLine28_Text            = "    PAGEFILECONFIG.vbs /Query /FO table"
  186. CONST L_ShowQueryUsageLine29_Text            = "    PAGEFILECONFIG.vbs /Query /FO csv /NH"
  187. CONST L_ShowQueryUsageLine30_Text            = "    PAGEFILECONFIG.vbs /Query /S system /U user"
  188. CONST L_ShowQueryUsageLine31_Text            = "    PAGEFILECONFIG.vbs /Query /S system /U user /P password /FO LIST"
  189.  
  190. ' constants for error messages
  191. CONST L_UnableToInclude_ErrorMessage         = "ERROR: Unable to include the common module ""CmdLib.Wsc""."
  192. CONST L_InvalidHelpUsage_ErrorMessage        = "ERROR: Invalid Help Usage. Use only /? for help."
  193. CONST L_InvalidParameter_ErrorMessage        = "ERROR: Invalid argument/Option - '%1'."
  194. CONST L_InvalidInput_ErrorMessage            = "ERROR: Invalid input. Please check the input values."
  195. CONST L_InvalidCredentials_ErrorMessage      = "ERROR: Invalid credentials. Verify the machine, user and password given."
  196. CONST L_InvalidVolumeName_ErrorMessage       = "ERROR: Invalid volume '%1' specified."
  197. CONST L_InvalidUserReply_ErrorMessage        = "ERROR: Invalid choice. Enter a valid choice."
  198. CONST L_FailCreateObject_ErrorMessage        = "ERROR: Unable to create object."
  199. CONST L_UnableToRetrieveInfo_ErrorMessage    = "ERROR: Unable to retrieve information."
  200. CONST L_CannotCreate_ErrorMessage            = "ERROR: Paging file for the specified volume '%1' cannot be created."
  201. CONST L_InvalidPhysicalDrive_ErrorMessage    = "ERROR: Volume '%1' is not a valid physical drive."
  202. CONST L_UpdateFailed_ErrorMessage            = "ERROR: Paging file update failed."
  203. CONST L_InvalidInitSizeValue_ErrorMessage    = "ERROR: Enter a numeric value for the initial paging file size."
  204. CONST L_InvalidMaxSizeValue_ErrorMessage     = "ERROR: Enter a numeric value for the maximum paging file size."
  205. CONST L_CONST_Systemmanaged_Earlier_Text     = "ERROR: The page file on drive %1 is system managed. Both initial and maximum size must be specified."
  206.  
  207. ' constant for hint message to show remote connectivity failure
  208. CONST L_HintCheckConnection_Message          = "ERROR: Please check the system name, credentials and WMI (WBEM) service."
  209.  
  210. ' constants for info. messages
  211. CONST L_PageFileDoesNotExist_ErrorMessage    = "ERROR: No paging file exists on volume '%1'"
  212. CONST L_NoPageFiles_Message                  = "ERROR: No paging file(s) available."
  213.  
  214. ' constants for Syntax Error Messages
  215. CONST L_InvalidSyntax_ErrorMessage           = "ERROR: Invalid Syntax."
  216. CONST L_InvalidServerName_ErrorMessage       = "ERROR: Invalid Syntax. System name cannot be empty."
  217. CONST L_InvalidUserName_ErrorMessage         = "ERROR: Invalid Syntax. User name cannot be empty."
  218. CONST L_NoHeaderNotAllowed_ErrorMessage      = "ERROR: /NH option is allowed only for ""TABLE"" and ""CSV"" formats."
  219. CONST L_TypeUsage_Message                    = "Type ""%1 /?"" for usage."
  220. CONST L_TypeCreateUsage_Message              = "Type ""%1 /Create /?"" for usage."
  221. CONST L_TypeChangeUsage_Message              = "Type ""%1 /Change /?"" for usage."
  222. CONST L_TypeDeleteUsage_Message              = "Type ""%1 /Delete /?"" for usage."
  223. CONST L_TypeQueryUsage_Message               = "Type ""%1 /Query /?"" for usage."
  224.  
  225. ' constants for missing mandatory option messages
  226. CONST L_VolumeNameNotSpecified_ErrorMessage  = "Mandatory option '/VO' is missing."
  227. CONST L_InitialSizeNotSpecified_ErrorMessage = "Either '/SYS' or both '/I' and '/M' are mandatory with Create option."
  228. CONST L_MaximumSizeNotSpecified_ErrorMessage = "Mandatory option '/M' is missing."
  229. CONST L_NoneoftheSizeSpecified_ErrorMessage  = "Either '/SYS' or one of '/I' and '/M' are mandatory with Change option."
  230. CONST L_CONST_NoneoftheSizes_AllowedWithSysManaged_Text  = "Either '/I' or '/M' can not be specified with '/SYS'."
  231. CONST L_FormatNotSpecified_ErrorMessage      = "Mandatory options '/FO' is missing."
  232.  
  233. ' error messages for invalid usage of s,u,p switches
  234. CONST L_InvalidServerCredentials_ErrorMessage = "ERROR: Invalid Syntax. /U can be specified only when /S is specified."
  235. CONST L_InvalidUserCredentials_ErrorMessage   = "ERROR: Invalid Syntax. /P can be specified only when /U is specified."
  236.  
  237. ' constants for Mutliple line Error Messages
  238. CONST L_InsufficientMaxSize1_ErrorMessage    = "ERROR: The maximum paging file size on volume '%1' should be greater than or "
  239. CONST L_InsufficientMaxSize2_ErrorMessage    = "       equal to the initial paging file size, and less than %2 MB or less "
  240. CONST L_InsufficientMaxSize3_ErrorMessage    = "       than the disk size."
  241. CONST L_InitialSizeRange1_ErrorMessage       = "ERROR: The initial paging file size must be between 2 MB and %1 MB, and "
  242. CONST L_InitialSizeRange2_ErrorMessage       = "       cannot exceed the amount of free space on the drive '%2' selected. "
  243. CONST L_NotEnoughSpace1_ErrorMessage         = "ERROR: There is not enough space on the drive '%1' for the paging file"
  244. CONST L_NotEnoughSpace2_ErrorMessage         = "       Please enter a smaller number or free some disk space."
  245. CONST L_AtLeastFiveMB1_ErrorMessage          = "ERROR: There is not enough space on the drive '%1' to create the paging file"
  246. CONST L_AtLeastFiveMB2_ErrorMessage          = "       size specified. At least 5 megabytes of free disk space must be left"
  247. CONST L_AtLeastFiveMB3_ErrorMessage          = "       after the paging file is created. Specify a smaller paging file size"
  248. CONST L_AtLeastFiveMB4_ErrorMessage          = "       or free some disk space."
  249. CONST L_DiskTooSmall1_ErrorMessage           = "ERROR: Drive '%1' is too small for the maximum paging file size specified."
  250. CONST L_DiskTooSmall2_ErrorMessage           = "       Please enter a smaller number."
  251. CONST L_CannotDelete1_ErrorMessage           = "ERROR: The paging file from volume '%1' cannot be deleted."
  252. CONST L_CannotDelete2_ErrorMessage           = "       At least one paging file must be present."
  253.  
  254. ' constants for Mutliple line Warning Messages
  255. CONST L_GrowsToFreeSpaceWarning1_Message     = "WARNING: Drive '%1' does not have enough free space for the maximum paging "
  256. CONST L_GrowsToFreeSpaceWarning2_Message     = "         file specified. If you continue with this setting, the paging file "
  257. CONST L_GrowsToFreeSpaceWarning3_Message     = "         will only grow to the size of the available free space (%2 MB)."
  258. CONST L_CrashDumpSettingWarning1_Message     = "WARNING: If the paging file on volume '%1' has an initial size of less than"
  259. CONST L_CrashDumpSettingWarning2_Message     = "         %2, then the system may not be able to create a crash dump debugging"
  260. CONST L_CrashDumpSettingWarning3_Message     = "         information file if a STOP error (blue screen) occurs."
  261.  
  262. ' constants for Multiple line SUCCESS / SKIPPING messages
  263. CONST L_ChangeIntSuccess1_Message            = "SUCCESS: The initial size for the paging file on '%1' was changed from "
  264. CONST L_ChangeIntSuccess2_Message            = "         %2 MB to %3 MB."
  265. CONST L_ChangeMaxSuccess1_Message            = "SUCCESS: The maximum size for the paging file on '%1' was changed from "
  266. CONST L_ChangeMaxSuccess2_Message            = "         %2 MB to %3 MB."
  267. CONST L_ChangeIntSkipping1_Message           = "SKIPPING: The initial size specified for the paging file on '%1' is same as "
  268. CONST L_ChangeIntSkipping2_Message           = "          the present value."
  269. CONST L_ChangeMaxSkipping1_Message           = "SKIPPING: The maximum size specified for the paging file on '%1' is same as "
  270. CONST L_ChangeMaxSkipping2_Message           = "          the present value."
  271. CONST L_CreateSuccess1_Message               = "SUCCESS: A paging file with initial size of %1 MB and a maximum size "
  272. CONST L_CreateSuccess2_Message               = "         of %2 MB was created on the volume: '%3'"
  273. CONST L_CreateSkipping_Message               = "SKIPPING: A paging file already exists on the volume: '%1'"
  274. CONST L_DeleteSuccess_Message                = "SUCCESS: The paging file from volume '%1' has successfully been removed."
  275. CONST L_CreateSystemSuccess_message          = "SUCCESS: The paging file of system managed size has been created on the volume: '%1'."
  276. CONST L_ChangeSystemSuccess_message          = "SUCCESS: The paging file on the volume '%1' has been changed to system managed size."
  277. CONST L_CONST_Already_SystemManaged_Text     = "ERROR: The page File on drive %1 is already system managed."
  278.  
  279. ' constant for other error messages
  280. CONST L_InvalidFormat_ErrorMessage           = "Invalid format '%1' specified."
  281. CONST L_SystemManagedSize_ErrorMessage       = "ERROR: Volume '%1' is system managed."
  282. CONST L_PromptForContinueAnyWay_Message      = "Continue Anyway [y/n]?"
  283. CONST L_NotAllowedMoreThanOnce_ErrorMessage  = "'%1' option is not allowed more than '1' time."
  284. CONST L_RestartComputer_Message              = "Restart the computer for these changes to take effect."
  285.  
  286. '******************************************************************************
  287. ' END of Localization Content
  288. '******************************************************************************
  289.  
  290. ' constants used for format selection
  291. CONST PatternFormat_Text                   = "^(table|list|csv)$"
  292. CONST DefaultFormat_Text                   = "list"
  293. CONST ListFormat_Text                      = "list"
  294.  
  295. ' the main options
  296. CONST OPTION_HELP                       = "?"
  297. CONST OPTION_CHANGE                     = "change"
  298. CONST OPTION_CREATE                     = "create"
  299. CONST OPTION_DELETE                     = "delete"
  300. CONST OPTION_QUERY                      = "query"
  301.  
  302. ' the suboptions
  303. CONST SUB_OPTION_SERVER                 = "s"
  304. CONST SUB_OPTION_USER                   = "u"
  305. CONST SUB_OPTION_PASSWORD               = "p"
  306. CONST SUB_OPTION_INTSIZE                = "i"
  307. CONST SUB_OPTION_MAXSIZE                = "m"
  308. CONST SUB_OPTION_VOLUME                 = "vo"
  309. CONST SUB_OPTION_FORMAT                 = "fo"
  310. CONST SUB_OPTION_NOHEADER               = "nh"
  311. CONST SUB_OPTION_SYSTEM_MANAGED         = "sys"
  312.  
  313. ' constant for CScript
  314. CONST CONST_CSCRIPT                     = 2
  315.  
  316. ' constants for error codes
  317. CONST CONST_ERROR                       = 0
  318.  
  319. ' constants for options
  320. CONST CONST_SHOW_USAGE                  = 3
  321. CONST CONST_CHANGE_OPTION               = 11
  322. CONST CONST_CREATE_OPTION               = 21
  323. CONST CONST_DELETE_OPTION               = 31
  324. CONST CONST_QUERY_OPTION                = 41
  325.  
  326. ' constant for matched pattern
  327. CONST CONST_NO_MATCHES_FOUND            = 0
  328.  
  329. ' utility specific constants
  330. CONST INITIAL_SIZE_LB                   = 2
  331. CONST DRIVE_TYPE                        = 3
  332. CONST MEGA_BYTES                        = " MB"
  333. CONST SIZE_FACTOR                       = 1.5
  334. CONST CONVERSION_FACTOR                 = 1048576
  335. CONST PAGEFILE_DOT_SYS                  = "\pagefile.sys"
  336. CONST CONST_SYSTEM_INIT_SIZE            = 0
  337. CONST CONST_SYSTEM_MAX_SIZE             = 0
  338.  
  339. ' constant for the UNC format server name
  340. CONST UNC_FORMAT_SERVERNAME_PREFIX      = "\\"
  341.  
  342. ' constants for exit values
  343. CONST EXIT_SUCCESS                      = 0
  344. CONST EXIT_UNEXPECTED                   = 255
  345. CONST EXIT_INVALID_INPUT                = 254
  346. CONST EXIT_METHOD_FAIL                  = 250
  347. CONST EXIT_QUERY_FAIL                   = 253
  348. CONST EXIT_INVALID_PARAM                = 999
  349. CONST EXIT_PARTIAL_SUCCESS              = 128
  350.  
  351. ' Define namespace and class names of wmi
  352. CONST CONST_WBEM_FLAG                   = 131072
  353. CONST CONST_NAMESPACE_CIMV2             = "root\cimv2"
  354. CONST CLASS_PAGE_FILE_SETTING           = "Win32_PageFileSetting"
  355. CONST CLASS_LOGICAL_DISK                = "Win32_LogicalDisk"
  356. CONST CLASS_COMPUTER_SYSTEM             = "Win32_ComputerSystem"
  357. CONST CLASS_PAGE_FILE_USAGE             = "Win32_PageFileUsage"
  358. CONST CLASS_OPERATING_SYSTEM            = "Win32_OperatingSystem"
  359. CONST CLASS_PERFDISK_PHYSICAL_DISK      = "Win32_PerfRawData_PerfDisk_PhysicalDisk"
  360.  
  361. Dim UseCscriptErrorMessage  ' string to store the CScript usage
  362. Dim blnLocalConnection      ' flag for local connection
  363. Dim blnSuccessMsg           ' flag for indicating if any success messages have been delivered
  364. Dim blnFailureMsg       ' flag to indicate if any failure messages have been delivered
  365. Dim component               ' object for the common module
  366.  
  367. ' Error Messages
  368. Dim InsufficientMaxSizeErrorMessage
  369. Dim InitialSizeRangeErrorMessage
  370. Dim NotEnoughSpaceErrorMessage
  371. Dim AtLeastFiveMBErrorMessage
  372. Dim DiskTooSmallErrorMessage
  373. Dim CannotDeleteErrorMessage
  374.  
  375. ' Warning Messages
  376. Dim GrowsToFreeSpaceWarningMessage
  377. Dim CrashDumpSettingWarningMessage
  378.  
  379. ' Success / Skipping messages
  380. Dim ChangeIntSuccessMessage
  381. Dim ChangeMaxSuccessMessage
  382. Dim ChangeIntSkippingMessage
  383. Dim ChangeMaxSkippingMessage
  384. Dim CreateSuccessMessage
  385.  
  386. InsufficientMaxSizeErrorMessage         = L_InsufficientMaxSize1_ErrorMessage & vbCRLF & _
  387.                                           L_InsufficientMaxSize2_ErrorMessage & vbCRLF & _
  388.                                           L_InsufficientMaxSize3_ErrorMessage
  389. InitialSizeRangeErrorMessage            = L_InitialSizeRange1_ErrorMessage & vbCRLF & _
  390.                                           L_InitialSizeRange2_ErrorMessage
  391. NotEnoughSpaceErrorMessage              = L_NotEnoughSpace1_ErrorMessage & vbCRLF & _
  392.                                           L_NotEnoughSpace2_ErrorMessage
  393. AtLeastFiveMBErrorMessage               = L_AtLeastFiveMB1_ErrorMessage & vbCRLF & _
  394.                                           L_AtLeastFiveMB2_ErrorMessage & vbCRLF & _
  395.                                           L_AtLeastFiveMB3_ErrorMessage & vbCRLF & _
  396.                                           L_AtLeastFiveMB4_ErrorMessage
  397. DiskTooSmallErrorMessage                = L_DiskTooSmall1_ErrorMessage & vbCRLF & _
  398.                                           L_DiskTooSmall2_ErrorMessage
  399. CannotDeleteErrorMessage                = L_CannotDelete1_ErrorMessage & vbCRLF & _
  400.                                           L_CannotDelete2_ErrorMessage
  401.  
  402. GrowsToFreeSpaceWarningMessage          = L_GrowsToFreeSpaceWarning1_Message & vbCRLF & _
  403.                                           L_GrowsToFreeSpaceWarning2_Message & vbCRLF & _
  404.                                           L_GrowsToFreeSpaceWarning3_Message
  405. CrashDumpSettingWarningMessage          = L_CrashDumpSettingWarning1_Message & vbCRLF & _
  406.                                           L_CrashDumpSettingWarning2_Message & vbCRLF & _
  407.                                           L_CrashDumpSettingWarning3_Message
  408.  
  409. ChangeIntSuccessMessage                 = L_ChangeIntSuccess1_Message & vbCRLF & _
  410.                                           L_ChangeIntSuccess2_Message
  411. ChangeMaxSuccessMessage                 = L_ChangeMaxSuccess1_Message & vbCRLF & _
  412.                                           L_ChangeMaxSuccess2_Message
  413. ChangeIntSkippingMessage                = L_ChangeIntSkipping1_Message & vbCRLF & _
  414.                                           L_ChangeIntSkipping2_Message
  415. ChangeMaxSkippingMessage                = L_ChangeMaxSkipping1_Message & vbCRLF & _
  416.                                           L_ChangeMaxSkipping2_Message
  417. CreateSuccessMessage                    = L_CreateSuccess1_Message & vbCRLF & _
  418.                                           L_CreateSuccess2_Message
  419.  
  420. blnLocalConnection = FALSE
  421. blnSuccessMsg      = FALSE
  422. blnFailureMsg      = FALSE
  423.  
  424.  
  425. ' create the object for commom module
  426. Set component = CreateObject( "Microsoft.CmdLib" )
  427.  
  428. ' check if the commom module(CmdLib.wsc) is not registered
  429. If Err.Number Then
  430.     Err.Clear
  431.     WScript.Echo(L_UnableToInclude_ErrorMessage)
  432.     WScript.Quit(EXIT_METHOD_FAIL)
  433. End If
  434.  
  435. ' set the scripting host to WScript
  436. Set component.ScriptingHost = WScript.Application
  437.  
  438. ' Check whether the script is run using CScript
  439. If CInt(component.checkScript) <> CONST_CSCRIPT Then
  440.     UseCscriptErrorMessage = L_UseCscript1_ErrorMessage & vbCRLF & _
  441.                              ExpandEnvironmentString(L_UseCscript2_ErrorMessage) & vbCRLF & vbCRLF & _
  442.                              L_UseCscript3_ErrorMessage & vbCRLF & _
  443.                              L_UseCscript4_ErrorMessage & vbCRLF & vbCRLF & _
  444.                              ExpandEnvironmentString(L_UseCscript5_ErrorMessage)
  445.     WScript.Echo (UseCscriptErrorMessage)
  446.     WScript.Quit(EXIT_UNEXPECTED)
  447. End If
  448.  
  449. ' call the main function
  450. Call VBMain()
  451.  
  452. ' quit with exit value = 0
  453. WScript.Quit(EXIT_SUCCESS)
  454.  
  455.  
  456. '******************************************************************************
  457. '* Sub:     VBMain
  458. '*
  459. '* Purpose: This is the main function which starts execution 
  460. '*
  461. '* Input:   None
  462. '*
  463. '* Output:  None
  464. '*
  465. '******************************************************************************
  466.  
  467. Sub VBMain()
  468.  
  469.     ON ERROR RESUME NEXT
  470.     Err.Clear
  471.  
  472.     ' Declaring main variables
  473.     Dim strMachine             ' machine to configure page files on
  474.     Dim strUserName            ' user name to connect to the machine
  475.     Dim strPassword            ' password for the user
  476.     Dim intIntSize             ' initial size for the page file
  477.     Dim intMaxSize             ' maximum size for the page file
  478.     Dim strVolName             ' volume name
  479.     Dim objVols                ' object containing volume names
  480.     Dim strFormat              ' query display format
  481.     Dim blnNoHeader            ' stores if -nh is specified or not
  482.     Dim blnSystemManaged       ' Specifies whether pagefile has to be system managed
  483.     Dim blnInitSize            ' Specifies whether /I switch is specified or not
  484.     Dim blnmaxSize             ' Specifies whether /M switch is specified or not
  485.     Dim intMainOption          ' main option specified
  486.     Dim intTempResult          ' temporary variable to hold the return value
  487.     Dim blnValidArguments      ' stores the return value of ValidateArguments
  488.  
  489.     ' Initializing Variables
  490.     intTempResult = CONST_ERROR           ' default is CONST_ERROR (=0)
  491.     strFormat     = DefaultFormat_Text  ' default format is LIST
  492.     blnInitSize   = FALSE
  493.     blnMaxSize    = FALSE
  494.  
  495.     Set objVols = CreateObject("Scripting.Dictionary")
  496.     objVols.CompareMode = VBBinaryCompare
  497.     If Err.Number Then
  498.         ' Unable to create the dictionary object.
  499.         Err.Clear
  500.         WScript.Echo(L_FailCreateObject_ErrorMessage)
  501.         WScript.Quit(EXIT_METHOD_FAIL)
  502.     End If
  503.  
  504.     intTempResult  = intParseCmdLine( strMachine,   _
  505.                                       strUserName,  _
  506.                                       strPassword,  _
  507.                                       intIntSize,   _
  508.                                       intMaxSize,   _
  509.                                       strVolName,   _
  510.                                       objVols,      _
  511.                                       strFormat,    _
  512.                                       blnNoHeader,  _
  513.                                       blnSystemManaged,  _
  514.                                       blnInitSize, _
  515.                                       blnMaxSize, _
  516.                                       intMainOption )
  517.  
  518.     ' Select the operation specified by the user
  519.     Select Case intTempResult
  520.         Case CONST_SHOW_USAGE
  521.             Select Case intMainOption
  522.                 Case CONST_CHANGE_OPTION
  523.                     Call ShowChangeUsage()
  524.                 Case CONST_CREATE_OPTION
  525.                     Call ShowCreateUsage()
  526.                 Case CONST_DELETE_OPTION
  527.                     Call ShowDeleteUsage()
  528.                 Case CONST_QUERY_OPTION
  529.                     Call ShowQueryUsage()
  530.                 Case Else
  531.                     Call ShowUsage()
  532.             End Select
  533.  
  534.         Case CONST_CHANGE_OPTION
  535.             blnValidArguments = ValidateArguments (strMachine, strUserName, strPassword, _
  536.                                                    intIntSize, intMaxSize, objVols, strFormat, _
  537.                                                    blnNoHeader, blnSystemManaged, blnInitSize, _
  538.                                                    blnMaxSize, intMainOption)
  539.             ' If all arguments valid, proceed
  540.             If blnValidArguments Then
  541.                 Call ProcessChange(strMachine, strUserName, strPassword, _
  542.                                    intIntSize, intMaxSize, blnSystemManaged, objVols)
  543.             End If
  544.  
  545.         Case CONST_CREATE_OPTION
  546.             blnValidArguments = ValidateArguments (strMachine, strUserName, strPassword, _
  547.                                                    intIntSize, intMaxSize, objVols, strFormat, _
  548.                                                    blnNoHeader, blnSystemManaged, blnInitSize, _
  549.                                                    blnMaxSize, intMainOption)
  550.             ' If all arguments valid, proceed
  551.             If blnValidArguments Then
  552.                 Call ProcessCreate(strMachine, strUserName, strPassword, _
  553.                                    intIntSize, intMaxSize, blnSystemManaged, objVols)
  554.             End If
  555.  
  556.         Case CONST_DELETE_OPTION
  557.             blnValidArguments = ValidateArguments (strMachine, strUserName, strPassword, _
  558.                                                    intIntSize, intMaxSize, objVols, strFormat, _
  559.                                                    blnNoHeader, blnSystemManaged, blnInitSize, _
  560.                                                    blnMaxSize, intMainOption)
  561.             ' If all arguments valid, proceed
  562.             If blnValidArguments Then
  563.                 Call ProcessDelete(strMachine, strUserName, strPassword, blnSystemManaged, objVols)
  564.                 ' Here wild cards cannot be specified
  565.             End If
  566.  
  567.         Case CONST_QUERY_OPTION
  568.             blnValidArguments = ValidateArguments (strMachine, strUserName, strPassword, _
  569.                                                    intIntSize, intMaxSize, objVols, strFormat, _
  570.                                                    blnNoHeader, blnSystemManaged, blnInitSize, _
  571.                                                    blnMaxSize, intMainOption)
  572.             ' If all arguments valid, proceed
  573.             If blnValidArguments Then
  574.                 Call ProcessQuery(strMachine, strUserName, strPassword, strFormat, blnSystemManaged, blnNoHeader)
  575.             End If
  576.  
  577.         Case CONST_ERROR
  578.             WSCript.Quit(EXIT_INVALID_INPUT)
  579.         End Select
  580.  
  581. End Sub
  582.  
  583.  
  584. '******************************************************************************
  585. '* Function: intPaseCmdLine
  586. '*
  587. '* Purpose:  Parses the command line arguments into the variables
  588. '*
  589. '* Input:
  590. '*  [out]    strMachine         machine to configure page files on
  591. '*  [out]    strUserName        user name to connect to the machine
  592. '*  [out]    strPassword        password for the user
  593. '*  [out]    intIntSize         initial size for the page file
  594. '*  [out]    intMaxSize         maximum size for the page file
  595. '*  [in]     strVolName         individual volume name(s)
  596. '*  [out]    objVols            object containing volume names
  597. '*  [out]    strFormat          query display format
  598. '*  [out]    intMainOption      main option specified
  599. '*
  600. '* Output:   Returns CONST_SHOW_USAGE, CONST_CHANGE_OPTION ,
  601. '*                   CONST_CREATE_OPTION, CONST_DELETE_OPTION ,
  602. '*                   CONST_QUERY_OPTION or CONST_ERROR.
  603. '*           Displays error message and quits if invalid option is asked
  604. '*
  605. '******************************************************************************
  606. Private Function intParseCmdLine(   ByRef strMachine,   _
  607.                                     ByRef strUserName,  _
  608.                                     ByRef strPassword,  _
  609.                                     ByRef intIntSize,   _
  610.                                     ByRef intMaxSize,   _
  611.                                     ByVal strVolName,   _
  612.                                     ByRef objVols,      _
  613.                                     ByRef strFormat,    _
  614.                                     ByRef blnNoHeader,  _
  615.                                     ByRef blnSystemManaged,  _
  616.                                     ByRef blninitSize, _
  617.                                     ByRef blnMaxSize, _
  618.                                     ByRef intMainOption )
  619.  
  620.     ON ERROR RESUME NEXT
  621.     Err.Clear
  622.  
  623.     Dim strUserGivenArg      ' to temporarily store the user given arguments
  624.     Dim intArgIter           ' to count the number of arguments given
  625.     Dim intQCount            ' to count the number of help options given
  626.     Dim intMainOptionNumber  ' to count the number of main operations selected (Max allowed = 1)
  627.     Dim intVolumes           ' to store the number of volumes specified
  628.     ' Following variables are used to check if a switch if given more than once
  629.     Dim blnIntSizeSpecified
  630.     Dim blnMaxSizeSpecified
  631.     Dim blnFormatSpecified
  632.     Dim blnMachineSpecified
  633.     Dim blnUserSpecified
  634.     Dim blnPasswordSpecified
  635.  
  636.     ' Initialization
  637.     strUserGivenArg      = ""
  638.     intMainOptionNumber  = 0
  639.     intQCount            = 0
  640.     intArgIter           = 0
  641.     intParseCmdLine      = 0
  642.  
  643.     ' initially none of the parameters are specified, so set all flags to FALSE
  644.     blnIntSizeSpecified  = FALSE
  645.     blnMaxSizeSpecified  = FALSE
  646.     blnFormatSpecified   = FALSE
  647.     blnMachineSpecified  = FALSE
  648.     blnUserSpecified     = FALSE
  649.     blnPasswordSpecified = FALSE
  650.     blnNoHeader          = FALSE
  651.     blnSystemManaged     = FALSE
  652.  
  653.     ' if no arguments are specified, default option is query
  654.     If WScript.Arguments.Count = 0 Then
  655.         intParseCmdLine  = CONST_QUERY_OPTION
  656.         intMainOption    = CONST_QUERY_OPTION
  657.     End If
  658.  
  659.     ' Retrieve the command line parameters and their values
  660.     Do While intArgIter <= WScript.Arguments.Count - 1
  661.         strUserGivenArg = WScript.Arguments.Item(intArgIter)
  662.         ' check if the first character is a '-' OR '/' symbol; NOTE that "/" is the standard
  663.         If Left(strUserGivenArg,1) = "/"  OR Left(strUserGivenArg,1) = "-" Then
  664.             ' ignore the symbol and take the rest as the switch specified
  665.             strUserGivenArg = Right(strUserGivenArg,Len(strUserGivenArg) - 1)
  666.             Select Case LCase(strUserGivenArg)
  667.  
  668.                 Case LCase(OPTION_HELP)
  669.                     intQCount = intQCount + 1
  670.                     If (CInt(intQCount) >= 2 OR CInt(WScript.Arguments.Count) > 2) Then
  671.                         intParseCmdLine = CONST_ERROR
  672.                         WScript.Echo(L_InvalidHelpUsage_ErrorMessage)
  673.                         Exit Function
  674.                     Else
  675.                         intParseCmdLine = CONST_SHOW_USAGE
  676.                         intArgIter = intArgIter + 1
  677.                     End If
  678.  
  679.                 Case LCase(OPTION_CHANGE)
  680.                     If intQCount = 1 Then ' intQCount = 1 means help specified
  681.                         intParseCmdLine = CONST_SHOW_USAGE
  682.                     Else
  683.                         intParseCmdLine = CONST_CHANGE_OPTION
  684.                     End If
  685.                     intMainOption = CONST_CHANGE_OPTION
  686.                     intMainOptionNumber = intMainOptionNumber + 1
  687.                     intArgIter = intArgIter + 1
  688.  
  689.                 Case LCase(OPTION_CREATE)
  690.                     If intQCount = 1 Then ' intQCount = 1 means help specified
  691.                         intParseCmdLine = CONST_SHOW_USAGE
  692.                     Else
  693.                         intParseCmdLine = CONST_CREATE_OPTION
  694.                     End If
  695.                     intMainOption = CONST_CREATE_OPTION
  696.                     intMainOptionNumber = intMainOptionNumber + 1
  697.                     intArgIter = intArgIter + 1
  698.  
  699.                 Case LCase(OPTION_DELETE)
  700.                     If intQCount = 1 Then ' intQCount = 1 means help specified
  701.                         intParseCmdLine = CONST_SHOW_USAGE
  702.                     Else
  703.                         intParseCmdLine = CONST_DELETE_OPTION
  704.                     End If
  705.                     intMainOption = CONST_DELETE_OPTION
  706.                     intMainOptionNumber = intMainOptionNumber + 1
  707.                     intArgIter = intArgIter + 1
  708.  
  709.                 Case LCase(OPTION_QUERY)
  710.                     If intQCount = 1 Then ' intQCount = 1 means help specified
  711.                         intParseCmdLine = CONST_SHOW_USAGE
  712.                     Else
  713.                         intParseCmdLine = CONST_QUERY_OPTION
  714.                     End If
  715.                     intMainOption = CONST_QUERY_OPTION
  716.                     intMainOptionNumber = intMainOptionNumber + 1
  717.                     intArgIter = intArgIter + 1
  718.  
  719.                 Case LCase(SUB_OPTION_SERVER)
  720.                     ' Check if server name is given with help usage
  721.                     If intParseCmdLine = CONST_SHOW_USAGE Then
  722.                         WScript.Echo(L_InvalidHelpUsage_ErrorMessage)
  723.                         WScript.Quit(EXIT_INVALID_INPUT)
  724.                     End If
  725.                     ' Check if Machine Name is already specified
  726.                     If NOT blnMachineSpecified Then
  727.                         blnMachineSpecified = TRUE ' Set Specified Flag to TRUE
  728.                         If NOT component.getArguments(L_MachineName_Text,strMachine,intArgIter,FALSE) Then
  729.                             component.VBPrintf L_InvalidSyntax_ErrorMessage
  730.                             Call typeMessage(intMainOption)
  731.                             intParseCmdLine = CONST_ERROR
  732.                             Exit Function
  733.                         End If
  734.                         intArgIter = intArgIter + 1
  735.                     Else
  736.                         component.VBPrintf L_InvalidSyntax_ErrorMessage & " " & _
  737.                         L_NotAllowedMoreThanOnce_ErrorMessage , _
  738.                         Array(WScript.Arguments.Item(intArgIter))
  739.                         ' print the appropriate help usage message
  740.                         Call typeMessage(intMainOption)
  741.                         WScript.Quit(EXIT_INVALID_INPUT)
  742.                     End If
  743.  
  744.                 Case LCase(SUB_OPTION_USER)
  745.                     ' Check if user name is given with help usage
  746.                     If intParseCmdLine = CONST_SHOW_USAGE Then
  747.                         WScript.Echo(L_InvalidHelpUsage_ErrorMessage)
  748.                         WScript.Quit(EXIT_INVALID_INPUT)
  749.                     End If
  750.                     ' Check if User Name is already specified
  751.                     If NOT blnUserSpecified Then
  752.                         blnUserSpecified = TRUE ' Set Specified Flag to TRUE
  753.                         If NOT component.getArguments(L_User_Text,strUserName,intArgIter,FALSE) Then
  754.                             component.VBPrintf L_InvalidSyntax_ErrorMessage
  755.                             Call typeMessage(intMainOption)
  756.                             intParseCmdLine = CONST_ERROR
  757.                             Exit Function
  758.                         End If
  759.                         intArgIter = intArgIter + 1
  760.                     Else
  761.                         component.VBPrintf L_InvalidSyntax_ErrorMessage & " " & _
  762.                         L_NotAllowedMoreThanOnce_ErrorMessage , _
  763.                         Array(WScript.Arguments.Item(intArgIter))
  764.                         ' print the appropriate help usage message
  765.                         Call typeMessage(intMainOption)
  766.                         WScript.Quit(EXIT_INVALID_INPUT)
  767.                     End If
  768.  
  769.                 Case LCase(SUB_OPTION_PASSWORD)
  770.                     ' Check if password is given with help usage
  771.                     If intParseCmdLine = CONST_SHOW_USAGE Then
  772.                         WScript.Echo(L_InvalidHelpUsage_ErrorMessage)
  773.                         WScript.Quit(EXIT_INVALID_INPUT)
  774.                     End If
  775.                     ' Check if Password is already specified
  776.                     If NOT blnPasswordSpecified Then
  777.                         blnPasswordSpecified = TRUE ' Set Specified Flag to TRUE
  778.                         If NOT component.getArguments(L_Password_Text,strPassword,intArgIter,FALSE) Then
  779.                             component.VBPrintf L_InvalidSyntax_ErrorMessage
  780.                             Call typeMessage(intMainOption)
  781.                             intParseCmdLine = CONST_ERROR
  782.                             Exit Function
  783.                         End If
  784.                         intArgIter = intArgIter + 1
  785.                     Else
  786.                         component.VBPrintf L_InvalidSyntax_ErrorMessage & " " & _
  787.                         L_NotAllowedMoreThanOnce_ErrorMessage , _
  788.                         Array(WScript.Arguments.Item(intArgIter))
  789.                         ' print the appropriate help usage message
  790.                         Call typeMessage(intMainOption)
  791.                         WScript.Quit(EXIT_INVALID_INPUT)
  792.                     End If
  793.  
  794.                 Case LCase(SUB_OPTION_INTSIZE)
  795.                     ' Check if initsize is given with help usage
  796.                     If intParseCmdLine = CONST_SHOW_USAGE Then
  797.                         WScript.Echo(L_InvalidHelpUsage_ErrorMessage)
  798.                         WScript.Quit(EXIT_INVALID_INPUT)
  799.                     End If
  800.                     ' Check if initsize is already specified
  801.                     If NOT blnIntSizeSpecified Then
  802.                         blnIntSizeSpecified = TRUE ' Set Specified Flag to TRUE
  803.                         If NOT component.getArguments(L_Intsize_Text,intIntSize,intArgIter,FALSE) Then
  804.                             component.VBPrintf L_InvalidSyntax_ErrorMessage
  805.                             Call typeMessage(intMainOption)
  806.                             intParseCmdLine = CONST_ERROR
  807.                             Exit Function
  808.                         End If
  809.                         blnInitSize = TRUE
  810.                         intArgIter = intArgIter + 1
  811.                     Else
  812.                         component.VBPrintf L_InvalidSyntax_ErrorMessage & " " & _
  813.                         L_NotAllowedMoreThanOnce_ErrorMessage , _
  814.                         Array(WScript.Arguments.Item(intArgIter))
  815.                         ' print the appropriate help usage message
  816.                         Call typeMessage(intMainOption)
  817.                         WScript.Quit(EXIT_INVALID_INPUT)
  818.                     End If
  819.  
  820.                 Case LCase(SUB_OPTION_MAXSIZE)
  821.                     ' Check if maxsize is given with help usage
  822.                     If intParseCmdLine = CONST_SHOW_USAGE Then
  823.                         WScript.Echo(L_InvalidHelpUsage_ErrorMessage)
  824.                         WScript.Quit(EXIT_INVALID_INPUT)
  825.                     End If
  826.                     ' Check if Maxsize is already specified
  827.                     If NOT blnMaxSizeSpecified Then
  828.                         blnMaxSizeSpecified = TRUE ' Set Specified Flag to TRUE
  829.                         If NOT component.getArguments(L_Maxsize_Text,intMaxSize,intArgIter,FALSE) Then
  830.                             component.VBPrintf L_InvalidSyntax_ErrorMessage
  831.                             Call typeMessage(intMainOption)
  832.                             intParseCmdLine = CONST_ERROR
  833.                             Exit Function
  834.                         End If
  835.                         blnMaxSize = TRUE
  836.                         intArgIter = intArgIter + 1
  837.                     Else
  838.                         component.VBPrintf L_InvalidSyntax_ErrorMessage & " " & _
  839.                         L_NotAllowedMoreThanOnce_ErrorMessage , _
  840.                         Array(WScript.Arguments.Item(intArgIter))
  841.                         ' print the appropriate help usage message
  842.                         Call typeMessage(intMainOption)
  843.                         WScript.Quit(EXIT_INVALID_INPUT)
  844.                     End If
  845.  
  846.                 Case LCase(SUB_OPTION_FORMAT)
  847.                     ' Check if maxsize is given with help usage
  848.                     If intParseCmdLine = CONST_SHOW_USAGE Then
  849.                         WScript.Echo(L_InvalidHelpUsage_ErrorMessage)
  850.                         WScript.Quit(EXIT_INVALID_INPUT)
  851.                     End If
  852.                     ' Check if format is already specified
  853.                     If NOT blnFormatSpecified Then
  854.                         blnFormatSpecified = TRUE ' Set Specified Flag to TRUE
  855.                         If NOT component.getArguments(L_Format_Text,strFormat,intArgIter,FALSE) Then
  856.                             component.VBPrintf L_InvalidSyntax_ErrorMessage
  857.                             Call typeMessage(intMainOption)
  858.                             intParseCmdLine = CONST_ERROR
  859.                             Exit Function
  860.                         End If
  861.                         intArgIter = intArgIter + 1
  862.                     Else
  863.                         component.VBPrintf L_InvalidSyntax_ErrorMessage & " " & _
  864.                         L_NotAllowedMoreThanOnce_ErrorMessage , _
  865.                         Array(WScript.Arguments.Item(intArgIter))
  866.                         ' print the appropriate help usage message
  867.                         Call typeMessage(intMainOption)
  868.                         WScript.Quit(EXIT_INVALID_INPUT)
  869.                     End If
  870.  
  871.                 Case LCase(SUB_OPTION_NOHEADER)
  872.                     ' Check if -nh is already specified
  873.                     If NOT blnNoHeader Then
  874.                         blnNoHeader = TRUE
  875.                         intArgIter = intArgIter + 1
  876.                     Else
  877.                         component.VBPrintf L_InvalidSyntax_ErrorMessage & " " & _
  878.                         L_NotAllowedMoreThanOnce_ErrorMessage , _
  879.                         Array(WScript.Arguments.Item(intArgIter))
  880.                         ' print the appropriate help usage message
  881.                         Call typeMessage(intMainOption)
  882.                         WScript.Quit(EXIT_INVALID_INPUT)
  883.                     End If
  884.  
  885.                 Case Lcase(SUB_OPTION_SYSTEM_MANAGED)
  886.                     ' Check if -sm is specified
  887.                       If Not blnSystemManaged Then
  888.                             blnSystemManaged = TRUE
  889.                             intArgIter = intArgIter + 1
  890.                       Else
  891.                           component.VBPrintf L_InvalidSyntax_ErrorMessage & " " & _
  892.                           L_NotAllowedMoreThanOnce_ErrorMessage, _
  893.                           Array(Wscript.Arguments.Item(intArgIter))
  894.                           ' Print the corresponding help usage error message
  895.                           Call typeMessage(intMainOption)
  896.                           Wscript.Quit(EXIT_INVALID_INPUT)
  897.                       End If
  898.                 Case LCase(SUB_OPTION_VOLUME)
  899.                     ' Check if volume is given with help usage
  900.                     If intParseCmdLine = CONST_SHOW_USAGE Then
  901.                         WScript.Echo(L_InvalidHelpUsage_ErrorMessage)
  902.                         WScript.Quit(EXIT_INVALID_INPUT)
  903.                     End If
  904.                     If NOT component.getArguments(L_Volume_Text,strVolName,intArgIter,FALSE) Then
  905.                         component.VBPrintf L_InvalidSyntax_ErrorMessage
  906.                         Call typeMessage(intMainOption)
  907.                         intParseCmdLine = CONST_ERROR
  908.                         Exit Function
  909.                     Else
  910.                         If strVolName = "*" Then
  911.                             objVols.Add LCase(strVolName), -1
  912.                         Else
  913.                             If NOT objVols.Exists(LCase(strVolName)) Then
  914.                                 objVols.Add LCase(strVolName), -1
  915.                             End If
  916.                             intVolumes = objVols.Count
  917.                         End If
  918.                     End If
  919.                     intArgIter = intArgIter + 1
  920.  
  921.                 Case Else
  922.                     ' display the invalid param err msg first
  923.                     component.VBPrintf L_InvalidParameter_ErrorMessage, _
  924.                     Array(WScript.arguments.Item(intArgIter))
  925.                     ' then display the 'type ..usage' message
  926.                     Select Case CInt(intMainOption)
  927.                         Case CONST_CHANGE_OPTION
  928.                             component.VBPrintf L_TypeChangeUsage_Message, _
  929.                             Array(UCase(WScript.ScriptName))
  930.                             WScript.Quit(EXIT_INVALID_PARAM)
  931.                         Case CONST_CREATE_OPTION
  932.                             component.VBPrintf L_TypeCreateUsage_Message, _
  933.                             Array(UCase(WScript.ScriptName))
  934.                             WScript.Quit(EXIT_INVALID_PARAM)
  935.                         Case CONST_DELETE_OPTION
  936.                             component.VBPrintf L_TypeDeleteUsage_Message, _
  937.                             Array(UCase(WScript.ScriptName))
  938.                             WScript.Quit(EXIT_INVALID_PARAM)
  939.                         Case CONST_QUERY_OPTION
  940.                             component.VBPrintf L_TypeQueryUsage_Message, _
  941.                             Array(UCase(WScript.ScriptName))
  942.                             WScript.Quit(EXIT_INVALID_PARAM)
  943.                         Case Else
  944.                             component.VBPrintf L_TypeUsage_Message, _
  945.                             Array(UCase(WScript.ScriptName))
  946.                             WScript.Quit(EXIT_INVALID_PARAM)
  947.                     End Select
  948.  
  949.             End Select
  950.  
  951.         Else
  952.             ' invalid argument specified
  953.             ' display the invalid param err msg first
  954.             component.VBPrintf L_InvalidParameter_ErrorMessage, _
  955.             Array(WScript.arguments.Item(intArgIter))
  956.             ' then display the 'type ..usage' message
  957.             Select Case CInt(intMainOption)
  958.                 Case CONST_CHANGE_OPTION
  959.                     component.VBPrintf L_TypeChangeUsage_Message, _
  960.                     Array(UCase(WScript.ScriptName))
  961.                     WScript.Quit(EXIT_INVALID_PARAM)
  962.                 Case CONST_CREATE_OPTION
  963.                     component.VBPrintf L_TypeCreateUsage_Message, _
  964.                     Array(UCase(WScript.ScriptName))
  965.                     WScript.Quit(EXIT_INVALID_PARAM)
  966.                 Case CONST_DELETE_OPTION
  967.                     component.VBPrintf L_TypeDeleteUsage_Message, _
  968.                     Array(UCase(WScript.ScriptName))
  969.                     WScript.Quit(EXIT_INVALID_PARAM)
  970.                 Case CONST_QUERY_OPTION
  971.                     component.VBPrintf L_TypeQueryUsage_Message, _
  972.                     Array(UCase(WScript.ScriptName))
  973.                     WScript.Quit(EXIT_INVALID_PARAM)
  974.                 Case Else
  975.                     component.VBPrintf L_TypeUsage_Message, _
  976.                     Array(UCase(WScript.ScriptName))
  977.                     WScript.Quit(EXIT_INVALID_PARAM)
  978.             End Select
  979.  
  980.         End If
  981.  
  982.     Loop
  983.  
  984.     ' check if the there is any volume(s) specified.
  985.     If objVols.Count = 0 Then
  986.         intVolumes = objVols.Count
  987.     End If
  988.  
  989.     ' Check if volumes | * is specified along with help 
  990.     If (intVolumes > 0 AND intQCount = 1) Then
  991.         WScript.Echo(L_InvalidHelpUsage_ErrorMessage)
  992.         WScript.Quit(EXIT_INVALID_INPUT)
  993.     End If
  994.  
  995.     ' Check if two major operations are selected at a time
  996.     If ( intMainOptionNumber > 1 ) Then
  997.         WScript.Echo(L_InvalidSyntax_ErrorMessage)
  998.         component.VBPrintf L_TypeUsage_Message,Array(UCase(WScript.ScriptName))
  999.         WScript.Quit(EXIT_INVALID_INPUT)
  1000.     ElseIf (intQcount = 0 AND intmainoption = 0) Then
  1001.         intMainOption = CONST_QUERY_OPTION
  1002.     End If
  1003.  
  1004.     ' check if NO major option(s) is specified, but other switches are specified
  1005.     If ( intMainOptionNumber = 0 ) Then
  1006.         If  blnIntSizeSpecified  OR _
  1007.             blnMaxSizeSpecified  OR _
  1008.             blnFormatSpecified   OR _
  1009.             blnMachineSpecified  OR _
  1010.             blnUserSpecified     OR _
  1011.             blnPasswordSpecified OR _
  1012.             blnNoHeader          OR _
  1013.             intVolumes > 0       Then
  1014.             WScript.Echo(L_InvalidSyntax_ErrorMessage)
  1015.             component.VBPrintf L_TypeUsage_Message, _
  1016.             Array(UCase(WScript.ScriptName))
  1017.             WScript.Quit(EXIT_INVALID_INPUT)
  1018.         End If
  1019.     End If
  1020.  
  1021.     ' check if format is specified with create option
  1022.     If (intMainOption = CONST_CREATE_OPTION) Then
  1023.         If blnFormatSpecified Then
  1024.             WScript.Echo(L_InvalidSyntax_ErrorMessage)
  1025.             component.VBPrintf L_TypeCreateUsage_Message, _
  1026.             Array(UCase(WScript.ScriptName))
  1027.             WScript.Quit(EXIT_INVALID_INPUT)
  1028.         End If
  1029.     End If
  1030.  
  1031.     ' check if format is specified with change option
  1032.     If (intMainOption = CONST_CHANGE_OPTION) Then
  1033.         If blnFormatSpecified Then
  1034.             WScript.Echo(L_InvalidSyntax_ErrorMessage)
  1035.             component.VBPrintf L_TypeChangeUsage_Message, _
  1036.             Array(UCase(WScript.ScriptName))
  1037.             WScript.Quit(EXIT_INVALID_INPUT)
  1038.         End If
  1039.     End If
  1040.  
  1041.     ' check if /Initsize, /Maxsize, /FO are specified
  1042.     If (intMainOption = CONST_DELETE_OPTION) Then
  1043.         If (blnIntSizeSpecified OR blnMaxSizeSpecified OR blnFormatSpecified OR blnSystemManaged) Then
  1044.             WScript.Echo(L_InvalidSyntax_ErrorMessage)
  1045.             component.VBPrintf L_TypeDeleteUsage_Message, _
  1046.             Array(UCase(WScript.ScriptName))
  1047.             WScript.Quit(EXIT_INVALID_INPUT)
  1048.         End If
  1049.     End If
  1050.  
  1051.     ' check if /Initsize, /Maxsize, are specified
  1052.     If (intMainOption = CONST_QUERY_OPTION) Then
  1053.         If (blnIntSizeSpecified OR blnMaxSizeSpecified OR blnSystemManaged) Then
  1054.             WScript.Echo(L_InvalidSyntax_ErrorMessage)
  1055.             component.VBPrintf L_TypeQueryUsage_Message, _
  1056.             Array(UCase(WScript.ScriptName))
  1057.             WScript.Quit(EXIT_INVALID_INPUT)
  1058.         End If
  1059.     End If
  1060.  
  1061. End Function
  1062.  
  1063. '******************************************************************************
  1064. '* Function: ValidateArguments
  1065. '*
  1066. '* Purpose:  Validates the command line arguments given by the user
  1067. '*
  1068. '* Input:
  1069. '*  [out]    strMachine        machine to configure page files on
  1070. '*  [out]    strUserName       user name to connect to the machine
  1071. '*  [out]    strPassword       password for the user
  1072. '*  [out]    intIntSize        the initial size for the page file
  1073. '*  [out]    intMaxSize        the maximum size for the page file
  1074. '*  [out]    objVols           the object containing volume names
  1075. '*  [out]    strFormat         the query display format
  1076. '*  [out]    blnNoHeader       the query display format
  1077. '*  [out]    intMainOption     the main option specified
  1078. '*
  1079. '* Output:   Returns true if all valid else displays error message and quits
  1080. '*           Gets the password from the user if not specified along with User.
  1081. '*
  1082. '******************************************************************************
  1083. Private Function ValidateArguments ( ByRef strMachine,  _
  1084.                                      ByRef strUserName, _
  1085.                                      ByRef strPassword, _
  1086.                                      ByRef intIntSize,  _
  1087.                                      ByRef intMaxSize,  _
  1088.                                      ByRef objVols,     _
  1089.                                      ByRef strFormat,   _
  1090.                                      ByRef blnNoHeader, _
  1091.                                      ByRef blnSystemManaged, _
  1092.                                      ByRef blnInitSize, _
  1093.                                      ByRef blnMaxSize, _
  1094.                                      ByRef intMainOption)
  1095.     ON ERROR RESUME NEXT
  1096.     Err.Clear
  1097.  
  1098.     Dim strMatchPattern  ' the pattern to be matched
  1099.     Dim intVolumes       ' to count the no.of volumes specified
  1100.     Dim arrVolume        ' array to store the volumes specified
  1101.     Dim i                ' Loop variable
  1102.  
  1103.     ' Initialization
  1104.     intVolumes = CInt(objVols.Count)
  1105.     arrVolume  = objVols.Keys
  1106.     ValidateArguments = TRUE
  1107.     i = 0
  1108.  
  1109.     ' Check if invalid server name is given
  1110.     If NOT IsEmpty(strMachine) Then
  1111.         If Trim(strMachine) = vbNullString Then
  1112.             WScript.Echo(L_InvalidServerName_ErrorMessage)
  1113.             WScript.Quit(EXIT_INVALID_INPUT)
  1114.         End If
  1115.     End If
  1116.  
  1117.     ' Check if invalid user name is given
  1118.     If NOT IsEmpty(strUserName) Then
  1119.         If Trim(strUserName) = vbNullString Then
  1120.             WScript.Echo(L_InvalidUserName_ErrorMessage)
  1121.             WScript.Quit(EXIT_INVALID_INPUT)
  1122.         End If
  1123.     End If
  1124.  
  1125.     ' check if user is given without machine OR password
  1126.     If ((strUserName <> VBEmpty) AND (strMachine = VBEmpty)) Then
  1127.         WScript.Echo L_InvalidServerCredentials_ErrorMessage
  1128.         component.VBPrintf L_TypeUsage_Message, _
  1129.         Array(UCase(WScript.ScriptName))
  1130.         WScript.Quit(EXIT_INVALID_INPUT)
  1131.     ' check if password is given without user OR machine
  1132.     ElseIf ((strPassword <> VBEmpty) AND (strUserName = VBEmpty))Then
  1133.         WScript.Echo L_InvalidUserCredentials_ErrorMessage
  1134.         component.VBPrintf L_TypeUsage_Message, _
  1135.         Array(UCase(WScript.ScriptName))
  1136.         WScript.Quit(EXIT_INVALID_INPUT)
  1137.     End If
  1138.  
  1139.     ' Check if initial size is specified, validate if it is a poistive number
  1140.     If Len(CStr(intIntSize)) > 0 Then
  1141.         ' Initsize should be numeric only
  1142.         ' chr(46) indicates "." (dot)
  1143.         If NOT (IsNumeric(intIntSize) AND InStr(intIntSize,chr(46)) = 0 AND Instr(intIntSize,"-") = 0) Then
  1144.             ValidateArguments = FALSE
  1145.             WScript.Echo L_InvalidInitSizeValue_ErrorMessage
  1146.             WScript.Quit(EXIT_INVALID_INPUT)
  1147.         End If
  1148.     End If
  1149.  
  1150.     ' Check if maximum size is specified, validate if it is a poistive number
  1151.     If Len(CStr(intMaxSize)) > 0 Then
  1152.         ' Maxsize should be numeric only
  1153.         ' chr(46) indicates "." (dot)
  1154.         If NOT (IsNumeric(intMaxSize) AND InStr(intMaxSize,chr(46)) = 0 AND Instr(intMaxSize,"-") = 0) Then
  1155.             ValidateArguments = FALSE
  1156.             WScript.Echo L_InvalidMaxSizeValue_ErrorMessage
  1157.             WScript.Quit(EXIT_INVALID_INPUT)
  1158.         End If
  1159.     End If
  1160.  
  1161.     Select Case CInt(intMainOption)
  1162.  
  1163.         Case CONST_CHANGE_OPTION
  1164.  
  1165.             ' Valid Cases : either (initsize + volume) OR (maxsize + volume) 
  1166.             ' OR (initsize + maxsize + volume)
  1167.  
  1168.             ' If none of the parameters (initsize or maxsize) is specified
  1169.             If blnSystemManaged = FALSE Then
  1170.                     If ( blnInitSize = FALSE AND blnMaxSize = FALSE ) Then
  1171.                             ValidateArguments = FALSE
  1172.                             WScript.Echo(L_InvalidSyntax_ErrorMessage & " " & _
  1173.                             L_NoneoftheSizeSpecified_ErrorMessage)
  1174.                             component.VBPrintf L_TypeChangeUsage_Message, _
  1175.                             Array(UCase(WScript.ScriptName))
  1176.                             WScript.Quit(EXIT_INVALID_INPUT)
  1177.                     End If
  1178.                     If (blnInitSize = TRUE AND Len(CStr(intIntSize)) = 0 ) Then
  1179.                             ValidateArguments = FALSE
  1180.                             Wscript.Echo(L_InvalidInput_ErrorMessage)
  1181.                             WScript.Quit(EXIT_INVALID_INPUT)
  1182.                     End If
  1183.                     If (blnMaxSize = TRUE AND Len(CStr(intMaxSize)) = 0 ) Then
  1184.                             ValidateArguments = FALSE
  1185.                             Wscript.Echo(L_InvalidInput_ErrorMessage)
  1186.                             WScript.Quit(EXIT_INVALID_INPUT)
  1187.                     End If
  1188.             Else
  1189.                     If (blnInitSize = TRUE OR blnMaxSize = TRUE) Then
  1190.                             ValidateArguments = FALSE
  1191.                             Wscript.Echo(L_InvalidSyntax_ErrorMessage & " " & _
  1192.                             L_CONST_NoneoftheSizes_AllowedWithSysManaged_Text)
  1193.                             component.VBPrintf L_TypeChangeUsage_Message, _
  1194.                             Array(Ucase(Wscript.ScriptName))
  1195.                             Wscript.Quit(EXIT_INVALID_INPUT)
  1196.                     End If
  1197.             End If
  1198.  
  1199.             ' check if the volume is specified
  1200.             If (objVols.Count = 0) Then
  1201.                 ValidateArguments = FALSE
  1202.                 WScript.Echo(L_InvalidSyntax_ErrorMessage & " " & _
  1203.                 L_VolumeNameNotSpecified_ErrorMessage)
  1204.                 component.VBPrintf L_TypeChangeUsage_Message, _
  1205.                 Array(UCase(WScript.ScriptName))
  1206.                 WScript.Quit(EXIT_INVALID_INPUT)
  1207.             ' check if volume name is valid
  1208.             ElseIf isValidDrive(objVols,intMainOption) Then
  1209.                 ValidateArguments = TRUE
  1210.             End If
  1211.  
  1212.         Case CONST_CREATE_OPTION
  1213.             If blnSystemManaged = FALSE Then
  1214.                     If ( blnInitSize = FALSE OR blnMaxSize = FALSE ) Then
  1215.                             ValidateArguments = FALSE
  1216.                             WScript.Echo(L_InvalidSyntax_ErrorMessage & " " & _
  1217.                             L_InitialSizeNotSpecified_ErrorMessage)
  1218.                             component.VBPrintf L_TypeCreateUsage_Message, _
  1219.                             Array(UCase(WScript.ScriptName))
  1220.                             WScript.Quit(EXIT_INVALID_INPUT)
  1221.                     End If
  1222.                     If (blnInitSize = TRUE AND Len(CStr(intIntSize)) = 0 ) Then
  1223.                             ValidateArguments = FALSE
  1224.                             Wscript.Echo(L_InvalidInput_ErrorMessage)
  1225.                             WScript.Quit(EXIT_INVALID_INPUT)
  1226.                     End If
  1227.                     If (blnMaxSize = TRUE AND Len(CStr(intMaxSize)) = 0 ) Then
  1228.                             ValidateArguments = FALSE
  1229.                             Wscript.Echo(L_InvalidInput_ErrorMessage)
  1230.                             WScript.Quit(EXIT_INVALID_INPUT)
  1231.                     End If
  1232.            Else
  1233.                     If (blnInitSize = TRUE OR blnMaxSize = TRUE) Then
  1234.                             ValidateArguments = FALSE
  1235.                             Wscript.Echo(L_InvalidSyntax_ErrorMessage & " " & _
  1236.                             L_CONST_NoneoftheSizes_AllowedWithSysManaged_Text)
  1237.                             component.VBPrintf L_TypeCreateUsage_Message, _
  1238.                             Array(Ucase(Wscript.ScriptName))
  1239.                             Wscript.Quit(EXIT_INVALID_INPUT)
  1240.                     End If
  1241.            End If
  1242.  
  1243.             ' volume name is required
  1244.             If (objVols.Count = 0) Then
  1245.                 ValidateArguments = FALSE
  1246.                 WScript.Echo(L_InvalidSyntax_ErrorMessage & " " & _
  1247.                 L_VolumeNameNotSpecified_ErrorMessage)
  1248.                 component.VBPrintf L_TypeCreateUsage_Message, _
  1249.                 Array(UCase(WScript.ScriptName))
  1250.                 WScript.Quit(EXIT_INVALID_INPUT)
  1251.             ' check if volume name is valid
  1252.             ElseIf isValidDrive(objVols,intMainOption) Then
  1253.                 ValidateArguments = TRUE
  1254.             End If
  1255.  
  1256.         Case CONST_DELETE_OPTION
  1257.  
  1258.             ' ONLY volume  is required
  1259.             If (objVols.Count = 0) Then
  1260.                 ValidateArguments = FALSE
  1261.                 WScript.Echo(L_InvalidSyntax_ErrorMessage & " " & _
  1262.                 L_VolumeNameNotSpecified_ErrorMessage)
  1263.                 component.VBPrintf L_TypeDeleteUsage_Message, _
  1264.                 Array(UCase(WScript.ScriptName))
  1265.                 WScript.Quit(EXIT_INVALID_INPUT)
  1266.             ' check if volume name is valid
  1267.             ElseIf isValidDrive(objVols,intMainOption) Then
  1268.                 ValidateArguments = TRUE
  1269.             End If
  1270.  
  1271.             ' Wild Card Character * is not allowed for /Delete option
  1272.             If (objVols.Exists("*")) Then
  1273.                 ValidateArguments = FALSE
  1274.                 objVols.Remove "*"
  1275.                 WScript.Echo(L_InvalidInput_ErrorMessage)
  1276.                 WScript.Quit(EXIT_INVALID_INPUT)
  1277.             End If
  1278.  
  1279.         Case CONST_QUERY_OPTION
  1280.  
  1281.             ' check if any format is specified.
  1282.             If Len(strFormat) > 0 Then
  1283.                 ' only table, list and csv display formats allowed
  1284.                 ' PatternFormat_Text contains ^(table|list|csv)$
  1285.                 If CInt(component.matchPattern(PatternFormat_Text, strFormat)) = CONST_NO_MATCHES_FOUND Then
  1286.                     component.vbPrintf L_InvalidSyntax_ErrorMessage & " " & _
  1287.                     L_InvalidFormat_ErrorMessage, Array(strFormat)
  1288.                     component.VBPrintf L_TypeQueryUsage_Message, _
  1289.                     Array(UCase(WScript.ScriptName))
  1290.                     WScript.Quit(EXIT_INVALID_INPUT)
  1291.                 End If
  1292.             End If
  1293.  
  1294.             ' Check if -nh is specified for LIST format
  1295.             If (blnNoHeader) AND LCase(strFormat) = LCase(ListFormat_Text) then
  1296.                 WScript.Echo (L_NoHeaderNotAllowed_ErrorMessage)
  1297.                 WScript.Quit(EXIT_INVALID_INPUT)
  1298.             End If 
  1299.  
  1300.             ' Validation to check if volume names are specified with Query Option:
  1301.             If (intVolumes <> 0) Then
  1302.                 ValidateArguments = FALSE
  1303.                 WScript.Echo(L_InvalidSyntax_ErrorMessage)
  1304.                 component.VBPrintf L_TypeQueryUsage_Message, _
  1305.                 Array(UCase(WScript.ScriptName))
  1306.                 WScript.Quit(EXIT_INVALID_INPUT)
  1307.             End If
  1308.  
  1309.         Case Else
  1310.  
  1311.             ' if intMainOption has some non-zero value means one operation is selected
  1312.             If (intMainOption > 0) Then
  1313.                 ' -operation & volname together are valid
  1314.                 ValidateArguments = TRUE
  1315.             Else
  1316.                 ValidateArguments = FALSE
  1317.                 WScript.Echo(L_InvalidInput_ErrorMessage)
  1318.                 WScript.Quit(EXIT_INVALID_INPUT)
  1319.             End If
  1320.  
  1321.     End Select
  1322.  
  1323.     ' verify If required credentials given
  1324.     If (((NOT IsEmpty(strUserName)) AND (IsEmpty(strMachine))) OR _
  1325.         ((NOT IsEmpty(strPassword)) AND (IsEmpty(strUserName))) )Then
  1326.         ValidateArguments = FALSE
  1327.         WScript.Echo (L_InvalidCredentials_ErrorMessage)
  1328.         WScript.Quit(EXIT_INVALID_INPUT)
  1329.     End If
  1330.  
  1331.     ' check if the machine name is specified using "\\" (UNC format)
  1332.     If Left(strMachine,2) = UNC_FORMAT_SERVERNAME_PREFIX Then
  1333.         If Len(strMachine) = 2 Then
  1334.             WScript.Echo L_InvalidInput_ErrorMessage
  1335.             WScript.Quit(EXIT_UNEXPECTED)
  1336.         End If
  1337.         ' remove the "\\" from the front
  1338.         strMachine = Mid(strMachine,3,Len(strMachine))
  1339.     End If
  1340.  
  1341.     ' If password not specified with the user name, Then get it using cmdlib.wsc function
  1342.     If ((NOT IsEmpty(strUserName)) AND (IsEmpty(strPassword)) OR strPassword = "*") Then
  1343.         strPassword = component.getPassword()
  1344.     End If
  1345.  
  1346. End Function
  1347.  
  1348. '******************************************************************************
  1349. '* Function: isValidDrive
  1350. '*
  1351. '* Purpose:  To check if the specified volume is valid or not
  1352. '*
  1353. '* Input:
  1354. '*  [in]     objVols            object that store the volumes specified
  1355. '*  [in]     intMainOption      the main option specified
  1356. '*
  1357. '* Output:   Returns TRUE or FALSE
  1358. '*
  1359. '******************************************************************************
  1360.  
  1361. Function isValidDrive(ByRef objVols,ByVal intMainOption)
  1362.  
  1363.     ON ERROR RESUME NEXT
  1364.     Err.Clear
  1365.  
  1366.     Dim intVolumes       ' to count the no.of volumes specified
  1367.     Dim arrVolume        ' array to store the volumes specified
  1368.     Dim i                ' Loop variable
  1369.  
  1370.     ' Initialization
  1371.     intVolumes = CInt(objVols.Count)
  1372.     arrVolume  = objVols.Keys
  1373.     isValidDrive = FALSE
  1374.     i = 0
  1375.  
  1376.     ' Check if the drive name is in correct Format [c-z]: or [C-Z]:
  1377.     ' This has to be checked for each Drive specified - Do While Loop
  1378.  
  1379.     Do While (i < intVolumes)
  1380.         ' Volumes specified are valid for all option except Query
  1381.         If intMainOption <> CONST_QUERY_OPTION Then
  1382.             ' Valid volume is either '*' OR a letter followed by a colon (total length = 2)
  1383.             If ((Len(arrVolume(i)) = 2) AND (InStr(arrVolume(i),chr(58)) = 2) OR arrVolume(i) = "*") Then
  1384.                 ' check if the volume name specified is in the format ^([c-zC-Z]:|\*)$
  1385.                 If CInt(component.matchPattern(L_VolumePatternFormat_Text,arrVolume(i))) = CONST_NO_MATCHES_FOUND Then
  1386.                     ' Invalid Volume Names or junk data is specified
  1387.                     component.VBPrintf L_InvalidVolumeName_ErrorMessage, _
  1388.                     Array(arrVolume(i))
  1389.                     isValidDrive = FALSE
  1390.                     ' remove the INVALID drive(s)
  1391.                     objVols.Remove arrVolume(i)
  1392.                 End If
  1393.             Else
  1394.                 isValidDrive = FALSE
  1395.                 component.VBPrintf L_InvalidVolumeName_ErrorMessage, _
  1396.                 Array(arrVolume(i))
  1397.                 objVols.Remove arrVolume(i)
  1398.             End If
  1399.             ' check the number of valid drives specified
  1400.             If objVols.Count = 0 Then
  1401.                 WScript.Quit(EXIT_INVALID_INPUT)
  1402.             End If
  1403.         Else
  1404.             WScript.Echo(L_InvalidInput_ErrorMessage)
  1405.             WScript.Quit (EXIT_INVALID_INPUT)
  1406.         End If
  1407.         isValidDrive = isValidDrive OR TRUE
  1408.         i = i + 1
  1409.     Loop
  1410.  
  1411. End Function
  1412.  
  1413. '******************************************************************************
  1414. '* Sub:     ProcessChange
  1415. '*
  1416. '* Purpose: Processes the /Change option and displays the changed
  1417. '*          details of the page file
  1418. '*
  1419. '* Input:
  1420. '*  [in]    strMachine         machine to configure page files on
  1421. '*  [in]    strUserName        user name to connect to the machine
  1422. '*  [in]    strPassword        password for the user
  1423. '*  [in]    intIntSize         the initial size for the page file
  1424. '*  [in]    intMaxSize         the maximum size for the page file
  1425. '*  [in]    objVols            the object containing volume names
  1426. '*
  1427. '* Output:  Displays error message and quits if connection fails
  1428. '*
  1429. '******************************************************************************
  1430. Private Sub ProcessChange( ByVal strMachine,  _
  1431.                            ByVal strUserName, _
  1432.                            ByVal strPassword, _
  1433.                            ByVal intIntSize,  _
  1434.                            ByVal intMaxSize,  _
  1435.                            ByVal blnSystemManaged, _
  1436.                            ByVal objVols      )
  1437.  
  1438.     ON ERROR RESUME NEXT
  1439.     Err.Clear
  1440.  
  1441.     Dim intOldInitialSize     ' to store the old intial size
  1442.     Dim intOldMaximumSize     ' to store the old maximum size
  1443.     Dim arrVolume             ' to store all the volumes specified
  1444.     Dim intVolumes            ' to store the no.of volumes specified
  1445.     Dim strQuery              ' to store the query for pagefiles
  1446.     Dim strQueryDisk          ' to store the query for disk
  1447.     Dim strQueryComp          ' to store the query for computersystem
  1448.     Dim objService            ' service object
  1449.     Dim objInstance           ' instance object
  1450.     Dim objInst               ' instance object
  1451.     Dim objEnumerator         ' collection set for query results
  1452.     Dim objEnumforDisk        ' collection set for query results
  1453.     Dim objEnum               ' collection set for query results
  1454.     Dim blnBothSpecified      ' flag to check if both initsize & maxsize are specified
  1455.     Dim intFreeSpace          ' to store total free space
  1456.     Dim intFreeDiskSpace      ' to store free disk space
  1457.     Dim intCurrentSize        ' to store the current pagefile size
  1458.     Dim intDiskSize           ' to store the disk size for the specified disk
  1459.     Dim intMemSize            ' to store physical memory size
  1460.     Dim intCrashDump          ' to store the current crash dump setting value
  1461.     Dim strReply              ' to store the user reply
  1462.     Dim strDriveName          ' to store the drive name
  1463.     Dim strHostName           ' to store the host name
  1464.     Dim intMaxSizeUB          ' to store the upper bound for maximum size
  1465.     Dim i                     ' loop variable
  1466.  
  1467.     ' Establish a connection with the server.
  1468.     If NOT component.wmiConnect(CONST_NAMESPACE_CIMV2 , _
  1469.                       strUserName , _
  1470.                       strPassword , _
  1471.                       strMachine  , _
  1472.                       blnLocalConnection, _
  1473.                       objService  ) Then
  1474.         WScript.Echo(L_HintCheckConnection_Message)
  1475.         WScript.Quit(EXIT_METHOD_FAIL)
  1476.     End If
  1477.  
  1478.     ' Initialize variables
  1479.     i = 0
  1480.     intFreeSpace      = 0
  1481.     intFreeDiskSpace  = 0
  1482.     intCurrentSize    = 0
  1483.     blnBothSpecified  = FALSE
  1484.     intMaxSizeUB      = 0
  1485.     strQuery          = "Select * From " & CLASS_PAGE_FILE_SETTING
  1486.  
  1487.     If (objVols.Exists("*")) Then
  1488.         Set objEnumerator = objService.ExecQuery(strQuery, "WQL", 0, null)
  1489.         For each objInstance in objEnumerator
  1490.             strDriveName = Mid(objInstance.Name,1,2)
  1491.             If NOT objVols.Exists (LCase(strDriveName)) Then
  1492.                 objVols.add LCase(strDriveName), -1
  1493.             End If
  1494.         Next
  1495.         objVols.remove "*"
  1496.     End If
  1497.  
  1498.     intVolumes = objVols.Count
  1499.     arrVolume  = objVols.keys
  1500.  
  1501.     ' get the host Name - used to get Crash Dump Settings
  1502.     strQueryComp = "Select * From " & CLASS_COMPUTER_SYSTEM
  1503.     Set objEnum = objService.ExecQuery(strQueryComp, "WQL", 0, null)
  1504.     ' check for any errors
  1505.     If Err.Number Then
  1506.         Err.Clear
  1507.         WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  1508.         WScript.Quit(EXIT_QUERY_FAIL)
  1509.     End If
  1510.  
  1511.     For each objInst in objEnum
  1512.         If NOT ISEmpty(objInst.Name) Then
  1513.             strHostName = objInst.Name
  1514.         Else
  1515.             WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  1516.             WScript.Quit(EXIT_QUERY_FAIL)
  1517.         End If
  1518.     Next
  1519.  
  1520.     ' check if initsize and maxsize both are specified
  1521.     If (Len(intIntSize) > 0 AND Len(intMaxSize) > 0) Then
  1522.         blnBothSpecified = TRUE
  1523.     End If
  1524.  
  1525.     ' check if no page files exist on the system.
  1526.     strQuery = "Select * From " & CLASS_PAGE_FILE_SETTING
  1527.     Set objEnumerator = objService.ExecQuery(strQuery, "WQL", 0, null)
  1528.     If (objEnumerator.Count = 0) Then
  1529.         WScript.Echo(L_NoPageFiles_Message)
  1530.         WScript.Quit(EXIT_UNEXPECTED)
  1531.     End If
  1532.  
  1533.     ' release the object for re-use.
  1534.     Set objEnumerator = nothing
  1535.  
  1536.     Do While( i < intVolumes )
  1537.         ' check if its a valid drive/volume - check from Win32_LogicalDisk
  1538.         strQueryDisk = "Select * From " & CLASS_LOGICAL_DISK & _
  1539.         " where DriveType = " & DRIVE_TYPE & " and DeviceID = '" & arrVolume(i) & "'"
  1540.         Set objEnumforDisk = objService.ExecQuery(strQueryDisk, "WQL", 0, null)
  1541.         If objEnumforDisk.Count > 0 Then
  1542.             strQuery = "Select * From " & CLASS_PAGE_FILE_SETTING
  1543.             strQuery = strQuery & " where NAME = '" & arrVolume(i) & _
  1544.             "\" & PAGEFILE_DOT_SYS & "'"
  1545.             Set objEnumerator = objService.ExecQuery(strQuery, "WQL", 0, null)
  1546.             ' check for any errors
  1547.             If Err.Number Then
  1548.                 Err.Clear
  1549.                 WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  1550.                 blnFailureMsg = TRUE
  1551.                 quitbasedonsuccess EXIT_QUERY_FAIL
  1552.             End If
  1553.  
  1554.             ' check if a page file exists on the specified volume
  1555.             If (objEnumerator.Count > 0) Then
  1556.                 For each objInstance in objEnumerator
  1557.                     If blnSystemManaged = TRUE Then
  1558.                             If( objInstance.InitialSize = 0 AND objInstance.MaximumSize = 0 ) Then
  1559.                                 Component.VBPrintf L_CONST_Already_SystemManaged_Text, Array(Ucase(arrVolume(i)))
  1560.                                 blnFailureMsg = TRUE
  1561.                                 Exit For
  1562.                             End If
  1563.                             objInstance.InitialSize =  CONST_SYSTEM_INIT_SIZE
  1564.                             objInstance.MaximumSize =  CONST_SYSTEM_MAX_SIZE
  1565.                             objInstance.Put_(CONST_WBEM_FLAG)
  1566.                             If Err.Number Then
  1567.                                 Err.Clear
  1568.                                 Component.VBPrintf L_CannotCreate_ErrorMessage,Array(Ucase(arrVolume(i)))
  1569.                                 blnFailureMsg = TRUE
  1570.                                 quitbasedonsuccess EXIT_INVALID_INPUT
  1571.                             End If
  1572.                             component.VBPrintf L_ChangeSystemSuccess_message, _
  1573.                             Array(UCase(arrVolume(i)))
  1574.                             blnSuccessMsg = TRUE
  1575.                             Exit For
  1576.                     Else
  1577.                         strDriveName = Mid(objInstance.Name,1,2)
  1578.                         
  1579.                         'If the page file was system managed, then, the user has to specify both 
  1580.                         'initial and maximum sizes..
  1581.                         If (objInstance.InitialSize =0 AND objInstance.MaximumSize = 0 ) Then
  1582.                                 If Not blnBothSpecified Then
  1583.                                         component.VBPrintf L_CONST_Systemmanaged_Earlier_Text, Array(Ucase( arrVolume(i)))
  1584.                                         blnFailureMsg = TRUE
  1585.                                         Exit For
  1586.                                  End If
  1587.                         End If
  1588.                         If NOT blnBothSpecified Then
  1589.                             ' check if initsize is given
  1590.                             If (intIntSize > 0) Then
  1591.                                 ' Check if initsize is greater than 2 MB
  1592.                                 If CLng(intIntSize) >= CLng(INITIAL_SIZE_LB) Then
  1593.                                     ' check for overflows
  1594.                                     If Err.Number Then
  1595.                                         Err.Clear
  1596.                                         ' get the upper bound allowed for maximum size
  1597.                                         intMaxSizeUB = getMaxSizeUB(objService)
  1598.                                         component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1599.                                         Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1600.                                         blnFailureMsg = TRUE
  1601.                                         quitbasedonsuccess EXIT_INVALID_INPUT
  1602.                                     End If
  1603.                                     ' get the drive name first
  1604.                                     strDriveName = Mid(objInstance.Name,1,2)
  1605.                                     ' get the free space available on the specified disk
  1606.                                     intFreeDiskSpace = getFreeSpaceOnDisk(strDriveName,objService)
  1607.                                     ' get the current pagefile size
  1608.                                     intCurrentSize = getCurrentPageFileSize(objService,objInstance)
  1609.                                     ' get the total free space
  1610.                                     If Len(intCurrentSize) > 0 Then
  1611.                                         intFreeSpace = intFreeDiskSpace + intCurrentSize
  1612.                                     Else
  1613.                                         WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  1614.                                         blnFailureMsg = TRUE
  1615.                                         quitbasedonsuccess EXIT_QUERY_FAIL
  1616.                                     End If
  1617.                                     ' Check if it is greater than free disk space
  1618.                                     If CLng(intIntSize) > CLng(intFreeSpace) Then
  1619.                                         ' check for overflows
  1620.                                         If Err.Number Then
  1621.                                             Err.Clear
  1622.                                             ' get the upper bound allowed for maximum size
  1623.                                             intMaxSizeUB = getMaxSizeUB(objService)
  1624.                                             component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1625.                                             Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1626.                                             blnFailureMsg = TRUE
  1627.                                             quitbasedonsuccess EXIT_INVALID_INPUT
  1628.                                         End If
  1629.                                         component.VBPrintf NotEnoughSpaceErrorMessage, Array( UCase(arrVolume(i)))
  1630.                                         blnFailureMsg = TRUE
  1631.                                         Exit For
  1632.                                     Else
  1633.                                         If CLng(intIntSize) > CLng(intFreeSpace) - 5 Then
  1634.                                             ' check for overflows
  1635.                                             If Err.Number Then
  1636.                                                 Err.Clear
  1637.                                                 WScript.Echo(L_InvalidInput_ErrorMessage)
  1638.                                                 blnFailureMsg = TRUE
  1639.                                                 quitbasedonsuccess EXIT_INVALID_INPUT
  1640.                                             End If
  1641.                                             component.VBPrintf AtLeastFiveMBErrorMessage, Array( UCase(arrVolume(i)))
  1642.                                             blnFailureMsg = TRUE
  1643.                                             Exit For
  1644.                                         Else
  1645.                                             ' only one of initsize, maxsize is specified
  1646.                                             ' check if the specified initsize is less than existing maxsize
  1647.                                             If (CInt(intIntSize) <= objInstance.MaximumSize) Then
  1648.                                                 ' get the crash dump setting value
  1649.                                                 intCrashDump = GetCrashDumpSetting(strUserName,strPassword,strMachine)
  1650.                                                 ' get the Physical Memory Size
  1651.                                                 intMemSize = GetPhysicalMemorySize(strHostName,objService)
  1652.                                                 ' If the user has selected "yes" for the warning message
  1653.                                                 If isCrashDumpValueSet(intCrashDump,intIntSize,intMemSize,arrVolume(i)) Then
  1654.                                                     ' Check if initsize is same as the present value
  1655.                                                     If (CInt(intIntSize) <> objInstance.InitialSize) Then
  1656.                                                         ' store the old initsize value
  1657.                                                         intOldInitialSize = objInstance.InitialSize
  1658.                                                         ' set the new initsize
  1659.                                                         objInstance.InitialSize = intIntSize
  1660.                                                         objInstance.Put_(CONST_WBEM_FLAG)
  1661.                                                         If Err.Number Then
  1662.                                                             Err.Clear
  1663.                                                             WScript.Echo(L_UpdateFailed_ErrorMessage)
  1664.                                                             blnFailureMsg = TRUE
  1665.                                                             quitbasedonsuccess EXIT_INVALID_INPUT
  1666.                                                         End If
  1667.                                                         component.VBPrintf ChangeIntSuccessMessage, _
  1668.                                                         Array(UCase(arrVolume(i)),CInt(intOldInitialSize),CInt(intIntSize))
  1669.                                                         blnSuccessMsg = TRUE
  1670.                                                         Exit For
  1671.                                                     Else
  1672.                                                         component.VBPrintf ChangeIntSkippingMessage, Array(UCase(arrVolume(i)))
  1673.                                                         blnFailureMsg = TRUE
  1674.                                                         Exit For
  1675.                                                     End If
  1676.                                                 
  1677.                                                 ' If User chooses No for CrashDumpSetting prompt
  1678.                                                 Else
  1679.                                                     ' Do Nothing just continue looping
  1680.                                                     Exit For
  1681.                                                 End If
  1682.                                             Else
  1683.                                                 ' get the upper bound allowed for maximum size
  1684.                                                 intMaxSizeUB = getMaxSizeUB(objService)
  1685.                                                 component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1686.                                                 Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1687.                                                 blnFailureMsg = TRUE
  1688.                                                 Exit For
  1689.                                             End If
  1690.                                         End If
  1691.                                     End If
  1692.                                 Else
  1693.                                     ' get the upper bound allowed for maximum size
  1694.                                     intMaxSizeUB = getMaxSizeUB(objService)
  1695.                                     component.VBPrintf InitialSizeRangeErrorMessage, _
  1696.                                     Array(intMaxSizeUB, UCase(arrVolume(i)))
  1697.                                     blnFailureMsg = TRUE
  1698.                                     quitbasedonsuccess EXIT_INVALID_INPUT
  1699.                                 End If
  1700.                             Else
  1701.                                 ' Check if initsize specified as 0
  1702.                                 If Len(intIntSize) > 0 Then
  1703.                                     ' get the upper bound allowed for maximum size
  1704.                                     intMaxSizeUB = getMaxSizeUB(objService)
  1705.                                     component.VBPrintf InitialSizeRangeErrorMessage, _
  1706.                                     Array(intMaxSizeUB, UCase(arrVolume(i)))
  1707.                                     blnFailureMsg = TRUE
  1708.                                     quitbasedonsuccess EXIT_INVALID_INPUT
  1709.                                 End If
  1710.                             End If ' initsize checked
  1711.  
  1712.                             ' check if maxsize is given
  1713.                             If (intMaxSize > 0) Then
  1714.                                 ' get the free space available on the specified disk
  1715.                                 intFreeDiskSpace = getFreeSpaceOnDisk(strDriveName,objService)
  1716.                                 ' get the current pagefile size
  1717.                                 intCurrentSize = getCurrentPageFileSize(objService,objInstance)
  1718.                                 ' get the total free space
  1719.                                 If Len(intCurrentSize) > 0 Then
  1720.                                     intFreeSpace = intFreeDiskSpace + intCurrentSize
  1721.                                 Else
  1722.                                     WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  1723.                                     blnFailureMsg = TRUE
  1724.                                     quitbasedonsuccess EXIT_QUERY_FAIL
  1725.                                 End If
  1726.  
  1727.                                 ' Get the Disk Size for the specified drive
  1728.                                 intDiskSize = GetDiskSize(arrVolume(i),objService)
  1729.                                 ' check if maxsize is more than initsize
  1730.                                 If (CLng(intMaxSize) > CLng(intDiskSize)) Then
  1731.                                     ' check for overflows
  1732.                                     If Err.Number Then
  1733.                                         Err.Clear
  1734.                                         ' get the upper bound allowed for maximum size
  1735.                                         intMaxSizeUB = getMaxSizeUB(objService)
  1736.                                         component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1737.                                         Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1738.                                         blnFailureMsg = TRUE
  1739.                                         quitbasedonsuccess EXIT_INVALID_INPUT
  1740.                                     End If
  1741.                                     component.VBPrintf DiskTooSmallErrorMessage, Array(UCase(arrVolume(i)))
  1742.                                     blnFailureMsg = TRUE
  1743.                                     Exit For
  1744.                                 Else
  1745.                                     If (CLng(intMaxSize) > CLng(intFreeSpace)) Then
  1746.                                         ' check for overflows
  1747.                                         If Err.Number Then
  1748.                                             Err.Clear
  1749.                                             WScript.Echo(L_InvalidInput_ErrorMessage)
  1750.                                             blnFailureMsg = TRUE
  1751.                                             quitbasedonsuccess EXIT_INVALID_INPUT
  1752.                                         End If
  1753.                                         component.VBPrintf GrowsToFreeSpaceWarningMessage, _
  1754.                                         Array(UCase(arrVolume(i)),intFreeSpace)
  1755.                                         strReply = getReply()
  1756.                                         If Trim(LCase(strReply)) = L_UserReplyYes_Text Then
  1757.                                             ' set the maxsize to be the free space on disk
  1758.                                             intMaxSize = intFreeSpace
  1759.                                             ' check if the given maxsize is greater than the existing initial size.
  1760.                                             If (CInt(intMaxSize) >= objInstance.InitialSize) Then
  1761.                                                 If (CInt(intMaxSize) <> objInstance.MaximumSize) Then
  1762.                                                     intOldMaximumSize = objInstance.MaximumSize
  1763.                                                     objInstance.MaximumSize = intMaxSize
  1764.                                                     objInstance.Put_(CONST_WBEM_FLAG)
  1765.                                                     If Err.Number Then
  1766.                                                         Err.Clear
  1767.                                                         WScript.Echo(L_UpdateFailed_ErrorMessage)
  1768.                                                         blnFailureMsg = TRUE
  1769.                                                         quitbasedonsuccess EXIT_INVALID_INPUT
  1770.                                                     End If
  1771.                                                     component.VBPrintf ChangeMaxSuccessMessage, _
  1772.                                                     Array(UCase(arrVolume(i)),CInt(intOldMaximumSize),CInt(intMaxSize))
  1773.                                                     blnSuccessMsg = TRUE
  1774.                                                     Exit For
  1775.                                                 Else
  1776.                                                     component.VBPrintf ChangeMaxSkippingMessage, Array(UCase(arrVolume(i)))
  1777.                                                     blnFailureMsg = TRUE
  1778.                                                     Exit For
  1779.                                                 End If
  1780.                                             Else
  1781.                                                 ' get the upper bound allowed for maximum size
  1782.                                                 intMaxSizeUB = getMaxSizeUB(objService)
  1783.                                                 component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1784.                                                 Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1785.                                                 blnFailureMsg = TRUE
  1786.                                                 Exit For
  1787.                                             End If
  1788.                                         ElseIf LCase(strReply) = L_UserReplyNo_Text Then
  1789.                                             ' Do Nothing continue with other drives
  1790.                                             Exit For
  1791.                                         Else
  1792.                                             WScript.Echo(L_InvalidInput_ErrorMessage)
  1793.                                             blnFailureMsg = TRUE
  1794.                                             ' Continue looping
  1795.                                             Exit For
  1796.                                         End If
  1797.                                     Else
  1798.                                         If (CInt(intMaxSize) >= objInstance.InitialSize) Then
  1799.                                             If (CInt(intMaxSize) <> objInstance.MaximumSize) Then
  1800.                                                 intOldMaximumSize = objInstance.MaximumSize
  1801.                                                 objInstance.MaximumSize = intMaxSize
  1802.                                                 objInstance.Put_(CONST_WBEM_FLAG)
  1803.                                                 If Err.Number Then
  1804.                                                     Err.Clear
  1805.                                                     WScript.Echo(L_UpdateFailed_ErrorMessage)
  1806.                                                     blnFailureMsg = TRUE
  1807.                                                     quitbasedonsuccess EXIT_INVALID_INPUT
  1808.                                                 End If
  1809.                                                 component.VBPrintf ChangeMaxSuccessMessage, _
  1810.                                                 Array(UCase(arrVolume(i)),CInt(intOldMaximumSize),CInt(intMaxSize))
  1811.                                                 blnSuccessMsg = TRUE
  1812.                                                 Exit For
  1813.                                             Else
  1814.                                                 component.VBPrintf ChangeMaxSkippingMessage, Array(UCase(arrVolume(i)))
  1815.                                                 blnFailureMsg = TRUE
  1816.                                                 Exit For
  1817.                                             End If
  1818.                                         Else
  1819.                                             ' get the upper bound allowed for maximum size
  1820.                                             intMaxSizeUB = getMaxSizeUB(objService)
  1821.                                             component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1822.                                             Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1823.                                             blnFailureMsg = TRUE
  1824.                                             Exit For
  1825.                                         End If
  1826.                                     End If
  1827.                                 End If
  1828.                             Else
  1829.                                 ' Check if maxsize specified as 0
  1830.                                 If Len(intMaxSize) > 0 Then
  1831.                                     ' get the upper bound allowed for maximum size
  1832.                                     intMaxSizeUB = getMaxSizeUB(objService)
  1833.                                     component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1834.                                     Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1835.                                     blnFailureMsg = TRUE
  1836.                                     Exit For
  1837.                                 End If
  1838.                             End If ' maxsize checked
  1839.  
  1840.                         Else
  1841.  
  1842.                             ' Case when both initsize and maxsize are selected
  1843.  
  1844.                             ' check if maxsize is greater than initsize
  1845.                             ' this will detect any overflow problems, if any
  1846.                             If CLng(intIntSize) > CLng(intMaxSize) Then
  1847.                                 ' check for overflows and clear the error
  1848.                                 If Err.Number Then Err.Clear
  1849.                                 ' get the upper bound allowed for maximum size
  1850.                                 intMaxSizeUB = getMaxSizeUB(objService)
  1851.                                 component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1852.                                 Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1853.                                 blnFailureMsg = TRUE
  1854.                                 quitbasedonsuccess EXIT_INVALID_INPUT
  1855.                             End If
  1856.  
  1857.                             If (intIntSize > 0) Then
  1858.                                 ' Check if initsize is greater than 2 MB
  1859.                                 If CLng(intIntSize) >= CLng(INITIAL_SIZE_LB) Then
  1860.                                     ' check for overflows
  1861.                                     If Err.Number Then
  1862.                                         Err.Clear
  1863.                                         ' get the upper bound allowed for maximum size
  1864.                                         intMaxSizeUB = getMaxSizeUB(objService)
  1865.                                         component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1866.                                         Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1867.                                         blnFailureMsg = TRUE
  1868.                                         quitbasedonsuccess EXIT_INVALID_INPUT
  1869.                                     End If
  1870.  
  1871.                                     ' get the free space available on the specified disk
  1872.                                     intFreeDiskSpace = getFreeSpaceOnDisk(strDriveName,objService)
  1873.                                     ' get the current pagefile size
  1874.                                     intCurrentSize = getCurrentPageFileSize(objService,objInstance)
  1875.                                     ' get the total free space
  1876.                                     If Len(intCurrentSize) > 0 Then
  1877.                                         intFreeSpace = intFreeDiskSpace + intCurrentSize
  1878.                                     Else
  1879.                                         WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  1880.                                         blnFailureMsg = TRUE
  1881.                                         quitbasedonsuccess EXIT_QUERY_FAIL
  1882.                                     End If
  1883.  
  1884.                                     ' check if it is greater than free disk space
  1885.                                     If CLng(intIntSize) > CLng(intFreeSpace) Then
  1886.                                         ' check for overflows
  1887.                                         If Err.Number Then
  1888.                                             Err.Clear
  1889.                                             ' get the upper bound allowed for maximum size
  1890.                                             intMaxSizeUB = getMaxSizeUB(objService)
  1891.                                             component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1892.                                             Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1893.                                             blnFailureMsg = TRUE
  1894.                                             quitbasedonsuccess EXIT_INVALID_INPUT
  1895.                                         End If
  1896.                                         component.VBPrintf NotEnoughSpaceErrorMessage, Array( UCase(arrVolume(i)))
  1897.                                         blnFailureMsg = TRUE
  1898.                                         Exit For
  1899.                                     End If
  1900.  
  1901.                                     If CLng(intIntSize) > CLng(intFreeSpace) - 5 Then
  1902.                                         ' check for overflows
  1903.                                         If Err.Number Then
  1904.                                             Err.Clear
  1905.                                             WScript.Echo(L_InvalidInput_ErrorMessage)
  1906.                                             blnFailureMsg = TRUE
  1907.                                             quitbasedonsuccess EXIT_INVALID_INPUT
  1908.                                         End If
  1909.                                         component.VBPrintf AtLeastFiveMBErrorMessage, Array( UCase(arrVolume(i)))
  1910.                                         blnFailureMsg = TRUE
  1911.                                         Exit For
  1912.                                     Else
  1913.                                         ' get the crash dump setting value
  1914.                                         intCrashDump = GetCrashDumpSetting(strUserName,strPassword,strMachine)
  1915.                                         ' get the Physical Memory Size
  1916.                                         intMemSize = GetPhysicalMemorySize(strHostName,objService)
  1917.                                         ' If the user has selected "yes" for the warning message
  1918.                                         If isCrashDumpValueSet(intCrashDump,intIntSize,intMemSize,arrVolume(i)) Then
  1919.                                             ' store the old initsize value
  1920.                                             intOldInitialSize = objInstance.InitialSize
  1921.                                             ' set the new initsize
  1922.                                             objInstance.InitialSize = intIntSize
  1923.                                             ' check if maxsize is given
  1924.                                             If (intMaxSize > 0) Then
  1925.                                                 ' Get the Disk Size for the specified drive
  1926.                                                 intDiskSize = GetDiskSize(arrVolume(i),objService)
  1927.                                                 ' check if maxsize is more than initsize
  1928.                                                 If (CLng(intMaxSize) > CLng(intDiskSize)) Then
  1929.                                                     ' check for overflows
  1930.                                                     If Err.Number Then
  1931.                                                         Err.Clear
  1932.                                                         ' get the upper bound allowed for maximum size
  1933.                                                         intMaxSizeUB = getMaxSizeUB(objService)
  1934.                                                         component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1935.                                                         Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1936.                                                         blnFailureMsg = TRUE
  1937.                                                         quitbasedonsuccess EXIT_INVALID_INPUT
  1938.                                                     End If
  1939.                                                     component.VBPrintf DiskTooSmallErrorMessage, _
  1940.                                                     Array(UCase(arrVolume(i)))
  1941.                                                     blnFailureMsg = TRUE
  1942.                                                     Exit For
  1943.                                                 Else
  1944.                                                     If (CLng(intMaxSize) > CLng(intFreeSpace)) Then
  1945.                                                         ' check for overflows
  1946.                                                         If Err.Number Then
  1947.                                                             Err.Clear
  1948.                                                             WScript.Echo(L_InvalidInput_ErrorMessage)
  1949.                                                             blnFailureMsg = TRUE
  1950.                                                             quitbasedonsuccess EXIT_INVALID_INPUT
  1951.                                                         End If
  1952.                                                         component.VBPrintf GrowsToFreeSpaceWarningMessage, _
  1953.                                                         Array(UCase(arrVolume(i)),intFreeSpace)
  1954.                                                         strReply = getReply()
  1955.                                                         If Trim(LCase(strReply)) = L_UserReplyYes_Text Then
  1956.                                                             ' set the maxsize to be the free space on disk
  1957.                                                             intMaxSize = intFreeSpace
  1958.                                                             intOldMaximumSize = objInstance.MaximumSize
  1959.                                                             objInstance.MaximumSize = intMaxSize
  1960.                                                             If ( CInt(intIntSize) <> intOldInitialSize ) Then
  1961.                                                                 objInstance.Put_(CONST_WBEM_FLAG)
  1962.                                                                 If Err.Number Then
  1963.                                                                     Err.Clear
  1964.                                                                     WScript.Echo(L_UpdateFailed_ErrorMessage)
  1965.                                                                     blnFailureMsg = TRUE
  1966.                                                                     quitbasedonsuccess EXIT_INVALID_INPUT
  1967.                                                                 End If
  1968.                                                                 component.VBPrintf ChangeIntSuccessMessage, _
  1969.                                                                 Array(UCase(arrVolume(i)),CInt(intOldInitialSize),CInt(intIntSize))
  1970.                                                                 blnSuccessMsg = TRUE
  1971.                                                             Else
  1972.                                                                 component.VBPrintf ChangeIntSkippingMessage, _
  1973.                                                                 Array(UCase(arrVolume(i)))
  1974.                                                                 blnFailureMsg = TRUE
  1975.                                                             End If
  1976.                                                             If (CInt(intMaxSize) <> intOldMaximumSize) Then
  1977.                                                                 objInstance.Put_(CONST_WBEM_FLAG)
  1978.                                                                 If Err.Number Then
  1979.                                                                     Err.Clear
  1980.                                                                     WScript.Echo(L_UpdateFailed_ErrorMessage)
  1981.                                                                     blnFailureMsg = TRUE
  1982.                                                                     quitbasedonsuccess EXIT_INVALID_INPUT
  1983.                                                                 End If
  1984.                                                                 component.VBPrintf ChangeMaxSuccessMessage, _
  1985.                                                                 Array(UCase(arrVolume(i)),CInt(intOldMaximumSize),CInt(intMaxSize))
  1986.                                                                 blnSuccessMsg = TRUE
  1987.                                                                 Exit For
  1988.                                                             Else
  1989.                                                                 component.VBPrintf ChangeMaxSkippingMessage, _
  1990.                                                                 Array(UCase(arrVolume(i)))
  1991.                                                                 blnFailureMsg = TRUE
  1992.                                                                 Exit For
  1993.                                                             End If
  1994.                                                         ElseIf LCase(strReply) = L_UserReplyNo_Text Then
  1995.                                                             Exit For
  1996.                                                         Else
  1997.                                                             WScript.Echo(L_InvalidInput_ErrorMessage)
  1998.                                                             blnFailureMsg = TRUE
  1999.                                                             Exit For
  2000.                                                         End If
  2001.                                                     Else
  2002.                                                         intOldMaximumSize = objInstance.MaximumSize
  2003.                                                         objInstance.MaximumSize = intMaxSize
  2004.                                                         objInstance.Put_(CONST_WBEM_FLAG)
  2005.                                                         If Err.Number Then
  2006.                                                             Err.Clear
  2007.                                                             WScript.Echo(L_UpdateFailed_ErrorMessage)
  2008.                                                             blnFailureMsg = TRUE
  2009.                                                             quitbasedonsuccess EXIT_INVALID_INPUT
  2010.                                                         End If
  2011.  
  2012.                                                         If (CInt(intIntSize) <> intOldInitialSize ) Then
  2013.                                                             component.VBPrintf ChangeIntSuccessMessage, _
  2014.                                                             Array(UCase(arrVolume(i)),CInt(intOldInitialSize),CInt(intIntSize))
  2015.                                                             blnSuccessMsg = TRUE
  2016.                                                         Else
  2017.                                                             component.VBPrintf ChangeIntSkippingMessage, Array(UCase(arrVolume(i)))
  2018.                                                             blnFailureMsg = TRUE
  2019.                                                         End If
  2020.  
  2021.                                                         If (CInt(intMaxSize) <> intOldMaximumSize) Then
  2022.                                                             component.VBPrintf ChangeMaxSuccessMessage, _
  2023.                                                             Array(UCase(arrVolume(i)),CInt(intOldMaximumSize),CInt(intMaxSize))
  2024.                                                             blnSuccessMsg = TRUE
  2025.                                                             Exit For
  2026.                                                         Else
  2027.                                                             component.VBPrintf ChangeMaxSkippingMessage, Array(UCase(arrVolume(i)))
  2028.                                                             blnFailureMsg = TRUE
  2029.                                                             Exit For
  2030.                                                         End If
  2031.                                                     End If
  2032.                                                 End If
  2033.                                             Else
  2034.                                                 ' Check if maxsize specified as 0
  2035.                                                 If Len(intMaxSize) > 0 Then
  2036.                                                     ' get the upper bound allowed for maximum size
  2037.                                                     intMaxSizeUB = getMaxSizeUB(objService)
  2038.                                                     component.VBPrintf InsufficientMaxSizeErrorMessage, _
  2039.                                                     Array( UCase(arrVolume(i)) , intMaxSizeUB )
  2040.                                                     blnFailureMsg = TRUE
  2041.                                                     quitbasedonsuccess EXIT_INVALID_INPUT
  2042.                                                 End If
  2043.                                             End If ' maxsize checked
  2044.                                         End If
  2045.                                     End If
  2046.                                 Else
  2047.                                     ' get the upper bound allowed for maximum size
  2048.                                     intMaxSizeUB = getMaxSizeUB(objService)
  2049.                                     component.VBPrintf InitialSizeRangeErrorMessage, _
  2050.                                     Array(intMaxSizeUB, UCase(arrVolume(i)))
  2051.                                     blnFailureMsg = TRUE
  2052.                                     quitbasedonsuccess EXIT_INVALID_INPUT
  2053.                                 End If
  2054.                             Else
  2055.                                 ' Check if initsize specified as 0
  2056.                                 If Len(intIntSize) > 0 Then
  2057.                                     ' get the upper bound allowed for maximum size
  2058.                                     intMaxSizeUB = getMaxSizeUB(objService)
  2059.                                     component.VBPrintf InitialSizeRangeErrorMessage, _
  2060.                                     Array(intMaxSizeUB, UCase(arrVolume(i)))
  2061.                                     blnFailureMsg = TRUE
  2062.                                     quitbasedonsuccess EXIT_INVALID_INPUT
  2063.                                 End If
  2064.                             End If ' initsize checked
  2065.                         End If
  2066.                     End If
  2067.                 Next
  2068.             Else
  2069.                 component.VBPrintf L_PageFileDoesNotExist_ErrorMessage, _
  2070.                 Array(UCase(arrVolume(i)))
  2071.                 blnFailureMsg = TRUE
  2072.             End If
  2073.         Else
  2074.             ' the drive does not exist
  2075.             component.VBPrintf L_InvalidVolumeName_ErrorMessage, _
  2076.             Array(UCase(arrVolume(i)))
  2077.             blnFailureMsg = TRUE
  2078.             ' remove the drive name from the valid drives list
  2079.             objVols.Remove arrVolume(i)
  2080.             ' decrement the loop count
  2081.             i = i - 1
  2082.             ' check for the no.of valid drive names from the specified list.
  2083.             If Cint(objVols.Count) = 0 Then
  2084.                 blnFailureMsg = TRUE
  2085.                 quitbasedonsuccess EXIT_INVALID_INPUT
  2086.             Else
  2087.                 intVolumes = objVols.Count
  2088.                 arrVolume  = objVols.keys
  2089.             End If
  2090.         End If
  2091.         i = i + 1
  2092.     Loop
  2093.  
  2094.     If blnSuccessMsg = TRUE then
  2095.         WScript.Echo L_RestartComputer_Message
  2096.     End If
  2097.     If blnFailureMsg = TRUE Then
  2098.     If blnSuccessMsg = TRUE Then
  2099.         Wscript.Quit( EXIT_PARTIAL_SUCCESS)
  2100.     else
  2101.         Wscript.Quit( EXIT_INVALID_INPUT)
  2102.     End If
  2103.     End If
  2104.  
  2105. End Sub
  2106.  
  2107. '******************************************************************************
  2108. '* Sub:     ProcessCreate
  2109. '*
  2110. '* Purpose: Creates new page files with the given specifications
  2111. '*
  2112. '* Input:
  2113. '*  [in]    strMachine         machine to configure page files on
  2114. '*  [in]    strUserName        user name to connect to the machine
  2115. '*  [in]    strPassword        password for the user
  2116. '*  [in]    intIntSize         the initial size for the page file
  2117. '*  [in]    intMaxSize         the maximum size for the page file
  2118. '*  [in]    objVols            the object containing volume names
  2119. '*
  2120. '* Output:  Displays error message and quits if connection fails
  2121. '*
  2122. '******************************************************************************
  2123. Private Sub ProcessCreate( ByVal strMachine,  _
  2124.                            ByVal strUserName, _
  2125.                            ByVal strPassword, _
  2126.                            ByVal intIntSize,  _
  2127.                            ByVal intMaxSize,  _
  2128.                            ByVal blnSystemManaged, _
  2129.                            ByVal objVols      )
  2130.  
  2131.     ON ERROR RESUME NEXT
  2132.     Err.Clear
  2133.  
  2134.     Dim arrVolume             ' to store all the volumes specified
  2135.     Dim intVolumes            ' to store the no.of volumes specified
  2136.     Dim strQuery              ' to store the query for pagefiles
  2137.     Dim strQueryDisk          ' to store the query for disk
  2138.     Dim strQueryComp          ' to store the query for getting host name
  2139.     Dim objService            ' service object
  2140.     Dim objInst               ' instance object
  2141.     Dim objInstance           ' instance object
  2142.     Dim objEnum               ' collection object for query results
  2143.     Dim objEnumforDisk        ' collection object for query results
  2144.  
  2145.     Dim strHostName           ' to store the host name
  2146.  
  2147.     Dim i                     ' Loop variable
  2148.  
  2149.     ' variables used only if * is specified
  2150.     Dim objEnumerator         ' collection object for query results
  2151.  
  2152.     i = 0
  2153.  
  2154.     If NOT component.wmiConnect(CONST_NAMESPACE_CIMV2 , _
  2155.                       strUserName , _
  2156.                       strPassword , _
  2157.                       strMachine  , _
  2158.                       blnLocalConnection , _
  2159.                       objService  ) Then
  2160.         WScript.Echo(L_HintCheckConnection_Message)
  2161.         WScript.Quit(EXIT_METHOD_FAIL)
  2162.     End If
  2163.  
  2164.     If (objVols.Exists("*")) Then
  2165.         ' build the query
  2166.         intVolumes = 0
  2167.         ' get all the drive names with drive type = 3 (other than floppy drive & CDROM Drive)
  2168.         strQuery = "Select DeviceID From " & CLASS_LOGICAL_DISK & _
  2169.         " where DriveType = " & DRIVE_TYPE
  2170.         ' execute the query
  2171.         Set objEnumerator = objService.ExecQuery(strQuery, "WQL", 48, null)
  2172.         ' check for any errors
  2173.         If Err.Number Then
  2174.             Err.Clear
  2175.             WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  2176.             WScript.Quit(EXIT_QUERY_FAIL)
  2177.         End If
  2178.  
  2179.         For each objInstance in objEnumerator
  2180.             ' check if the volumename is not an alias name and neither a mapped drive.
  2181.             If IsValidPhysicalDrive(objService, objInstance.DeviceID) Then
  2182.                 ' check if the volume name is specified more than once.
  2183.                 If NOT objVols.Exists(LCase(objInstance.DeviceID)) Then
  2184.                     objVols.Add LCase(objInstance.DeviceID),-1
  2185.                 End If
  2186.             End If
  2187.         Next
  2188.         ' Remove * from objVols after adding the drives to the object.
  2189.         objVols.Remove "*"
  2190.     End If
  2191.  
  2192.     intVolumes = objVols.Count
  2193.     arrVolume  = objVols.Keys
  2194.  
  2195.     ' Get the host Name - used to get Crash Dump Settings
  2196.     strQueryComp = "Select * From " & CLASS_COMPUTER_SYSTEM
  2197.     Set objEnum = objService.ExecQuery(strQueryComp, "WQL", 0, null)
  2198.     ' check for any errors
  2199.     If Err.Number Then
  2200.         Err.Clear
  2201.         WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  2202.         WScript.Quit(EXIT_QUERY_FAIL)
  2203.     End If
  2204.  
  2205.     For each objInst in objEnum
  2206.         If NOT ISEmpty(objInst.Name) Then
  2207.             strHostName = objInst.Name
  2208.         Else
  2209.             WSCript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  2210.             WScript.Quit(EXIT_QUERY_FAIL)
  2211.         End If
  2212.     Next
  2213.  
  2214.     ' No wild Cards Specified
  2215.     Do While( i < intVolumes )
  2216.  
  2217.         strQueryDisk = "Select * From " & CLASS_LOGICAL_DISK & _
  2218.         " where DriveType = " & DRIVE_TYPE & " and DeviceID = '" & arrVolume(i) & "'"
  2219.         Set objEnumforDisk = objService.ExecQuery(strQueryDisk, "WQL", 0, null)
  2220.  
  2221.         strQuery = "Select * From " & CLASS_PAGE_FILE_SETTING & _
  2222.         " where Name = '" & arrVolume(i) & "\" & PAGEFILE_DOT_SYS & "'"
  2223.         Set objEnum = objService.ExecQuery(strQuery, "WQL", 0, null)
  2224.  
  2225.         ' If valid drive and pagefile exists on that drive
  2226.         If (objEnumforDisk.Count = 0 AND objEnum.Count = 0 ) Then
  2227.             ' the drive does not exist
  2228.             component.VBPrintf L_InvalidVolumeName_ErrorMessage, _
  2229.             Array(UCase(arrVolume(i)))
  2230.             bFailureMsg = TRUE
  2231.             ' remove the drive name from the valid drives list
  2232.             objVols.Remove arrVolume(i)
  2233.             ' decrement the loop count
  2234.             i = i - 1
  2235.             ' check for the no.of valid drive names from the specified list.
  2236.             If Cint(objVols.Count) = 0 Then
  2237.                 blnFailureMsg = TRUE
  2238.                 quitbasedonsuccess EXIT_INVALID_INPUT
  2239.             Else
  2240.                 intVolumes = objVols.Count
  2241.                 arrVolume  = objVols.keys
  2242.             End If
  2243.         Else
  2244.             ' SKIP - if at least one instance is found then dont create a new instance
  2245.             If (objEnumforDisk.Count = 1 AND objEnum.Count = 1) Then
  2246.                 component.VBPrintf L_CreateSkipping_Message, _
  2247.                 Array(UCase(arrVolume(i)))
  2248.                 blnFailureMsg = TRUE
  2249.             Else
  2250.                 ' check if the volumename is an alias name or a mapped drive
  2251.                 If NOT IsValidPhysicalDrive(objService, arrVolume(i)) Then
  2252.                     component.VBPrintf L_InvalidPhysicalDrive_ErrorMessage, _
  2253.                     Array(UCase(arrVolume(i)))
  2254.                     blnFailureMsg = TRUE
  2255.                 Else
  2256.                      CreatePageFile objService, arrVolume, blnSystemManaged, _
  2257.                      intIntSize, intMaxSize, strMachine, strUserName, _
  2258.                      strPassword, strHostName, i
  2259.                 End If
  2260.            End If
  2261.         End If
  2262.         i = i + 1
  2263.     Loop
  2264.     ' Prompt for reboot if atleast one operation is successful
  2265.     If blnSuccessMsg = TRUE then
  2266.         WScript.Echo L_RestartComputer_Message
  2267.     End If
  2268.     ' DEcide on the return level. If atleast one succeds, return partial success.. If all fails return complete failure
  2269.     If blnFailureMsg = TRUE Then
  2270.     If blnSuccessMsg = TRUE Then
  2271.         Wscript.Quit( EXIT_PARTIAL_SUCCESS)
  2272.     else
  2273.         Wscript.Quit( EXIT_INVALID_INPUT)
  2274.     End If
  2275.     End If
  2276. End Sub
  2277.  
  2278. '**************************************************************************************************
  2279. '* sub:      CreatePageFile 
  2280. '* 
  2281. '* Purpose:  Creates new page file on a specified drive at the specified index
  2282. '*
  2283. '* INPUT:
  2284. '*
  2285. '* [IN]          objService         The WMI service object
  2286. '* [IN]          arrVolume          Array of volumes to create the page files on
  2287. '* [IN]          blnSystemManaged   Indicates whether the drive has to be system managed
  2288. '* [IN]          intIntSize         Indicates the InitialSize 
  2289. '* [IN]          intMaxSize         Indicates the Maximum Size
  2290. '* [IN]          strMachine         The system to connect to
  2291. '* [IN]          strUserName        User name
  2292. '* [IN]          strPassword        Password
  2293. '* [IN]          strHostName        The host name for the remote machine
  2294. '* [IN]          i                  The index of the drive name in arrVolume to create the page file
  2295. '*
  2296. '**************************************************************************************************
  2297.  
  2298. Private Sub CreatePageFile(ByVal objService, _
  2299.                            ByVal arrVolume, _
  2300.                            ByVal blnSystemManaged, _
  2301.                            ByVal intIntSize, _
  2302.                            ByVal intMaxSize, _
  2303.                            ByVal strMachine, _
  2304.                            ByVal strUserName, _
  2305.                            ByVal strPassword, _
  2306.                            ByVal strHostName, _
  2307.                            BYVal i)
  2308.     ON ERROR RESUME NEXT
  2309.   
  2310.     Dim objInstance           ' instance object
  2311.     Dim objNewInstance        ' instance object
  2312.     Dim intFreeSpace          ' to store total free space
  2313.     Dim intFreeDiskSpace      ' to store free disk space
  2314.     Dim intCurrentSize        ' to store the current pagefile size
  2315.     Dim intDiskSize           ' to store the disk size for the specified disk
  2316.     Dim intMemSize            ' to store physical memory size
  2317.     Dim intCrashDump          ' to store the current crash dump setting value
  2318.     Dim strReply              ' to store the user reply
  2319.     Dim intMaxSizeUB          ' to store the upper bound for maximum size
  2320.  
  2321.     intFreeSpace      = 0
  2322.     intFreeDiskSpace  = 0
  2323.     intCurrentSize    = 0
  2324.     intMaxSizeUB      = 0
  2325.     Err.Clear
  2326.                     ' set the security privilege to allow pagefile creation
  2327.                     objService.Security_.Privileges.AddAsString("SeCreatePagefilePrivilege")
  2328.                     If Err.Number then
  2329.                         Err.Clear
  2330.                         WScript.Echo("ERROR: Failed to set the security privilege.")
  2331.                         blnFailureMsg = TRUE
  2332.                         quitbasedonsuccess EXIT_METHOD_FAIL
  2333.                     End If
  2334.  
  2335.                     Set objInstance = objService.Get(CLASS_PAGE_FILE_SETTING)
  2336.                     ' check for any errors
  2337.                     If Err.Number Then
  2338.                         Err.Clear
  2339.                         Component.VBPrintf L_CannotCreate_ErrorMessage,Array(Ucase(arrVolume(i)))
  2340.                         blnFailureMsg = TRUE
  2341.                         quitbasedonsuccess EXIT_METHOD_FAIL
  2342.                     End If
  2343.  
  2344.                     Set objNewInstance = objInstance.SpawnInstance_
  2345.                     ' check for any errors
  2346.                     If Err.Number Then
  2347.                         Err.Clear
  2348.                         Component.VBPrintf L_CannotCreate_ErrorMessage,Array(Ucase(arrVolume(i)))
  2349.                         blnFailureMsg = TRUE
  2350.                         quitbasedonsuccess EXIT_INVALID_INPUT
  2351.                     End If
  2352.  
  2353.                     ' append the filename to the volume name
  2354.                     objNewInstance.Name = UCase(arrVolume(i)) & PAGEFILE_DOT_SYS
  2355.  
  2356.  
  2357.                     'Check if the page file has to be managed by the system
  2358.                     If blnSystemManaged = TRUE Then
  2359.                         objNewInstance.InitialSize =  CONST_SYSTEM_INIT_SIZE
  2360.                         objNewInstance.MaximumSize =  CONST_SYSTEM_MAX_SIZE
  2361.                         objNewInstance.Put_(CONST_WBEM_FLAG)
  2362.                         If Err.Number Then
  2363.                             Err.Clear
  2364.                             Component.VBPrintf L_CannotCreate_ErrorMessage,Array(Ucase(arrVolume(i)))
  2365.                             blnFailureMsg = TRUE
  2366.                             quitbasedonsuccess EXIT_INVALID_INPUT
  2367.                         End If
  2368.                         component.VBPrintf L_CreateSystemSuccess_message, _
  2369.                         Array(UCase(arrVolume(i)))
  2370.                         blnSuccessMsg = TRUE 
  2371.                     ' If not System managed
  2372.                     Else
  2373.                             ' check if maxsize is greater than initsize
  2374.                             ' this will detect any overflow problems, if any
  2375.                             If ( CLng(intIntSize) > CLng(intMaxSize) ) Then
  2376.                                 ' check for overflows and clear the error
  2377.                                 If Err.Number Then Err.Clear
  2378.                                 ' get the upper bound allowed for maximum size
  2379.                                 intMaxSizeUB = getMaxSizeUB(objService)
  2380.                                 component.VBPrintf InsufficientMaxSizeErrorMessage, _
  2381.                                 Array( UCase(arrVolume(i)) , intMaxSizeUB )
  2382.                                 blnFailureMsg = TRUE
  2383.                                 Exit Sub
  2384.                             End If
  2385.  
  2386.                             ' Check the initial size with the free space on the disk
  2387.                             If CLng(intIntSize) >= CLng(INITIAL_SIZE_LB) Then
  2388.                                 ' check for overflows
  2389.                                 If Err.Number Then 
  2390.                                     Err.Clear
  2391.                                     WScript.Echo(L_InvalidInput_ErrorMessage)
  2392.                                     blnFailureMsg = TRUE
  2393.                                     quitbasedonsuccess EXIT_INVALID_INPUT
  2394.                                 End If
  2395.                                 ' get the free space on the specified disk
  2396.                                 intFreeDiskSpace = getFreeSpaceOnDisk(arrVolume(i),objService)
  2397.                             
  2398.                                 ' get the total free space  Since its a new instane the current size willNOT be available. So the initial size is taken into considerarion for calculating the total free space.
  2399.                                 intFreeSpace = intFreeDiskSpace
  2400.                                 ' Check if it greater than free disk space
  2401.                                 If CLng(intIntSize) > CLng(intFreeSpace) Then
  2402.                                     ' check for overflows
  2403.                                     If Err.Number Then  
  2404.                                             Err.Clear
  2405.                                             WScript.Echo(L_InvalidInput_ErrorMessage)
  2406.                                             blnFailureMsg = TRUE
  2407.                                             quitbasedonsuccess EXIT_INVALID_INPUT
  2408.                                     End If
  2409.                                     component.VBPrintf NotEnoughSpaceErrorMessage, Array( UCase(arrVolume(i)))
  2410.                                     blnFailureMsg = TRUE
  2411.                                     Exit Sub
  2412.                                 End If
  2413.  
  2414.                                 If CLng(intIntSize) > CLng(intFreeSpace) - 5 Then
  2415.                                     ' check for overflows
  2416.                                     If Err.Number Then
  2417.                                     Err.Clear
  2418.                                     WScript.Echo(L_InvalidInput_ErrorMessage)
  2419.                                     blnFailureMsg = TRUE
  2420.                                     quitbasedonsuccess  EXIT_INVALID_INPUT
  2421.                                     End If
  2422.                                     component.VBPrintf AtLeastFiveMBErrorMessage, Array( UCase(arrVolume(i)))
  2423.                                     blnFailureMsg = TRUE
  2424.                                     Exit Sub
  2425.                                 End If
  2426.  
  2427.                                 ' get the crash dump setting value
  2428.                                 intCrashDump = GetCrashDumpSetting(strUserName,strPassword,strMachine)
  2429.                                 ' get the Physical Memory Size
  2430.                                 intMemSize = GetPhysicalMemorySize(strHostName,objService)
  2431.                                 ' check if the user has selected "yes" for the warning message
  2432.                                 If isCrashDumpValueSet(intCrashDump,intIntSize,intMemSize,arrVolume(i)) Then
  2433.                                     objNewInstance.InitialSize = CInt(intIntSize)
  2434.                                     ' Get the Disk Size for the specified drive
  2435.                                     intDiskSize = GetDiskSize(arrVolume(i),objService)
  2436.                                         If (CLng(intMaxSize) > CLng(intDiskSize)) Then
  2437.                                             ' check for overflows
  2438.                                             If Err.Number Then
  2439.                                                     Err.Clear
  2440.                                                     ' get the upper bound allowed for maximum size
  2441.                                                     intMaxSizeUB = getMaxSizeUB(objService)
  2442.                                                     component.VBPrintf InsufficientMaxSizeErrorMessage, _
  2443.                                                     Array( UCase(arrVolume(i)) , intMaxSizeUB )
  2444.                                                     blnFailureMsg = TRUE
  2445.                                                     quitbasedonsuccess EXIT_INVALID_INPUT
  2446.                                             End If
  2447.                                             component.VBPrintf DiskTooSmallErrorMessage, _
  2448.                                             Array(UCase(arrVolume(i)))
  2449.                                             blnFailureMsg = TRUE
  2450.                                             Exit Sub
  2451.                                         ElseIf (CLng(intMaxSize) > CLng(intFreeSpace)) Then
  2452.                                                 ' check for overflows
  2453.                                                 If Err.Number Then
  2454.                                                 Err.Clear
  2455.                                                 WScript.Echo(L_InvalidInput_ErrorMessage)
  2456.                                                 blnFailureMsg = TRUE
  2457.                                                 quitbasedonsuccess EXIT_INVALID_INPUT
  2458.                                                 End If
  2459.                                             component.VBPrintf GrowsToFreeSpaceWarningMessage, _
  2460.                                             Array(UCase(arrVolume(i)),intFreeSpace)
  2461.                                             strReply = getReply()
  2462.                                             If Trim(LCase(strReply)) = L_UserReplyYes_Text Then
  2463.                                                     ' maxsize can grow only to the free disk space available.
  2464.                                                     ' set the maxsize to the free space on disk.
  2465.                                                     intMaxSize = intFreeSpace
  2466.                                                     objNewInstance.MaximumSize = intMaxSize
  2467.                                                     objNewInstance.Put_(CONST_WBEM_FLAG)
  2468.                                                     If Err.Number Then
  2469.                                                             Err.Clear
  2470.                                                             Component.VBPrintf L_CannotCreate_ErrorMessage,Array(Ucase(arrVolume(i)))
  2471.                                                             blnFailureMsg = TRUE
  2472.                                                             quitbasedonsuccess EXIT_INVALID_INPUT
  2473.                                                     End If
  2474.                                                     component.VBPrintf CreateSuccessMessage, _
  2475.                                                     Array(CInt(intIntSize),CInt(intMaxSize),UCase(arrVolume(i)))
  2476.                                                     blnSuccessMsg = TRUE
  2477.                                             ElseIf LCase(strReply) = L_UserReplyNo_Text Then
  2478.                                                     Exit Sub
  2479.                         Else
  2480.                                                     WScript.Echo(L_InvalidInput_ErrorMessage)
  2481.                                                     blnFailureMsg = TRUE
  2482.                                                     Exit Sub
  2483.                                             End If
  2484.                                         Else
  2485.                                             objNewInstance.MaximumSize = CInt(intMaxSize)
  2486.                                             objNewInstance.Put_(CONST_WBEM_FLAG)
  2487.                                             If Err.Number Then
  2488.                                                     Err.Clear
  2489.                                                     Component.VBPrintf L_CannotCreate_ErrorMessage,Array(Ucase(arrVolume(i)))
  2490.                                                     blnFailureMsg = TRUE
  2491.                                                     quitbasedonsuccess EXIT_INVALID_INPUT
  2492.                                             End If
  2493.                                             component.VBPrintf CreateSuccessMessage, _
  2494.                                             Array(CInt(intIntSize),CInt(intMaxSize),UCase(arrVolume(i)))
  2495.                                             blnSuccessMsg = TRUE
  2496.                                         End If
  2497.                 End If  'End of IsCrashDumpset
  2498.                             Else    'If initial size is less than 2 MB
  2499.                                     ' get the upper bound allowed for maximum size
  2500.                                     intMaxSizeUB = getMaxSizeUB(objService)
  2501.                                     component.VBPrintf InitialSizeRangeErrorMessage, _
  2502.                                     Array(intMaxSizeUB, UCase(arrVolume(i)))
  2503.                                     blnFailureMsg = TRUE
  2504.                             End If
  2505.                     End If
  2506.                     ' End of system managed If condition
  2507. End Sub
  2508.  
  2509. '******************************************************************************
  2510. '* Sub:     ProcessDelete
  2511. '*
  2512. '* Purpose: Deletes existing page files on the specified volumes
  2513. '*
  2514. '* Input:
  2515. '*  [in]    strMachine         machine to configure page files on
  2516. '*  [in]    strUserName        user name to connect to the machine
  2517. '*  [in]    strPassword        password for the user
  2518. '*  [in]    objVols            the object containing volume names
  2519. '*
  2520. '* Output:  Displays error message and quits if connection fails
  2521. '*
  2522. '******************************************************************************
  2523. Private Sub ProcessDelete ( ByVal strMachine,  _
  2524.                             ByVal strUserName, _
  2525.                             ByVal strPassword, _
  2526.                             ByVal blnSystemManaged, _
  2527.                             ByVal objVols      )
  2528.     ON ERROR RESUME NEXT
  2529.     Err.Clear
  2530.  
  2531.     Dim arrVolume             ' to store all the volumes specified
  2532.     Dim intVolumes            ' to store the no.of volumes specified
  2533.     Dim objService            ' service object
  2534.     Dim objInstance           ' instance object
  2535.     Dim strQueryDisk          ' to store the query for disk
  2536.     Dim objEnumforDisk        ' collection object for query results
  2537.     Dim intMemSize            ' to store physical memory size
  2538.     Dim intCrashDump          ' to store the current crash dump setting value
  2539.     Dim strQueryComp          ' to store the query for computersystem
  2540.     Dim objEnum               ' collection object for query results
  2541.     Dim objInst               ' instance object
  2542.     Dim strHostName           ' to store the host name
  2543.     Dim i                     ' Loop variable
  2544.     Dim strQueryPageFile      ' to store the query for pagefiles
  2545.     Dim objEnumPageFile       ' collection object for pagefiles
  2546.  
  2547.     ' Establish connection to WMI to get pagefile info
  2548.     If NOT component.wmiConnect(CONST_NAMESPACE_CIMV2 , _
  2549.                           strUserName , _
  2550.                           strPassword , _
  2551.                           strMachine  , _
  2552.                           blnLocalConnection , _
  2553.                           objService  ) Then
  2554.             WScript.Echo(L_HintCheckConnection_Message)
  2555.             WScript.Quit(EXIT_METHOD_FAIL)
  2556.     End If
  2557.  
  2558.     i = 0
  2559.     intVolumes    = objVols.Count
  2560.     arrVolume     = objVols.Keys
  2561.  
  2562.     ' Get the host Name - used to get Crash Dump Settings
  2563.     strQueryComp = "Select * From " & CLASS_COMPUTER_SYSTEM
  2564.     Set objEnum = objService.ExecQuery(strQueryComp, "WQL", 0, null)
  2565.     ' check for any errors
  2566.     If Err.Number Then
  2567.         Err.Clear
  2568.         WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  2569.         WScript.Quit(EXIT_QUERY_FAIL)
  2570.     End If
  2571.  
  2572.     For each objInst in objEnum
  2573.         If NOT ISEmpty(objInst.Name) Then
  2574.             strHostName = objInst.Name
  2575.         Else
  2576.             WSCript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  2577.             WScript.Quit(EXIT_QUERY_FAIL)
  2578.         End If
  2579.     Next
  2580.  
  2581.     Do While( i < intVolumes )
  2582.         strQueryDisk = "Select * From " & CLASS_LOGICAL_DISK & _
  2583.         " where DriveType = " & DRIVE_TYPE & " and DeviceID = '" & arrVolume(i) & "'"
  2584.         Set objEnumforDisk = objService.ExecQuery(strQueryDisk, "WQL", 0, null)
  2585.         If objEnumforDisk.Count > 0 Then
  2586.             Set objInstance = objService.Get(CLASS_PAGE_FILE_SETTING & "='" & _
  2587.             arrVolume(i) & PAGEFILE_DOT_SYS & "'")
  2588.             If Err.Number Then
  2589.                 Err.Clear
  2590.                 component.VBPrintf L_PageFileDoesNotExist_ErrorMessage, _
  2591.                 Array(UCase(arrVolume(i)))
  2592.                 blnFailureMsg = TRUE
  2593.             Else
  2594.                 intCrashDump = GetCrashDumpSetting(strUserName,strPassword,strMachine)
  2595.                 ' get the Physical Memory Size
  2596.                 intMemSize = GetPhysicalMemorySize(strHostName,objService)
  2597.                 ' If the user has selected "yes" for the warning message
  2598.                 ' pass initsize as 0 because initsize = maxsize = 0 (assumed) after deletion
  2599.                 If isCrashDumpValueSet(intCrashDump,0,intMemSize,arrVolume(i)) Then
  2600.                         strQueryPageFile = "Select * from " & CLASS_PAGE_FILE_SETTING
  2601.                         Set objEnumPageFile = objService.ExecQuery(strQueryPageFile, "WQL", 0, null)
  2602.                         If objEnumPageFile.Count > 1 Then
  2603.                             ' Delete the instance
  2604.                             objInstance.Delete_
  2605.                             ' check for any errors
  2606.                             If Err.Number Then
  2607.                                 Err.Clear
  2608.                                 WScript.Echo(L_InvalidInput_ErrorMessage)
  2609.                                 blnFailureMsg = TRUE
  2610.                                 quitbasedonsuccess EXIT_INVALID_INPUT
  2611.                             End If
  2612.  
  2613.                             component.VBPrintf L_DeleteSuccess_Message, _
  2614.                             Array(UCase(arrVolume(i)))
  2615.                             blnSuccessMsg = TRUE
  2616.                         Else
  2617.                             component.VBPrintf CannotDeleteErrorMessage, _
  2618.                             Array(UCase(arrVolume(i)))
  2619.                             blnFailureMsg = TRUE
  2620.                         End If
  2621.                   End If
  2622.             End If
  2623.         Else
  2624.             ' the drive does not exist
  2625.             component.VBPrintf L_InvalidVolumeName_ErrorMessage, _
  2626.             Array(UCase(arrVolume(i)))
  2627.             blnFailureMsg = TRUE
  2628.             ' remove the drive name from the valid drives list
  2629.             objVols.Remove arrVolume(i)
  2630.             ' decrement the loop count
  2631.             i = i - 1
  2632.             ' check for the no.of valid drive names from the specified list.
  2633.             If Cint(objVols.Count) = 0 Then
  2634.                 blnFailureMsg = TRUE
  2635.                 quitbasedonsuccess EXIT_INVALID_INPUT
  2636.             Else
  2637.                 intVolumes = objVols.Count
  2638.                 arrVolume  = objVols.keys
  2639.             End If
  2640.         End If
  2641.         i = i + 1
  2642.     Loop
  2643.  
  2644. ' The instances of the following classes are also deleted along with the Win32_PageFile instances
  2645. ' Win32_PageFileUsage - instances are deleted only after reboot
  2646. ' Win32_PageFileSetting - instances are deleted automatically along with Win32_PageFile instances
  2647.  
  2648.    If blnSuccessMsg = TRUE then
  2649.         WScript.Echo L_RestartComputer_Message
  2650.     End If
  2651.     ' DEcide on the return level. If atleast one succeds, return partial success.. If all fails return complete failure
  2652.     If blnFailureMsg = TRUE Then
  2653.     If blnSuccessMsg = TRUE Then
  2654.         Wscript.Quit( EXIT_PARTIAL_SUCCESS)
  2655.     else
  2656.         Wscript.Quit( EXIT_INVALID_INPUT)
  2657.     End If
  2658.     End If
  2659.  
  2660. End sub
  2661.  
  2662.  
  2663. '******************************************************************************
  2664. '* Sub:     ProcessQuery
  2665. '*
  2666. '* Purpose: Displays the Page File Details in the specified format
  2667. '*
  2668. '* Input:
  2669. '*  [in]    strMachine         machine to configure page files on
  2670. '*  [in]    strUserName        user name to connect to the machine
  2671. '*  [in]    strPassword        password for the user
  2672. '*  [in]    strFormat          the query display format
  2673. '*  [in]    blnNoHeader        flag to store if -nh is specified or not
  2674. '*
  2675. '* Output:  Displays error message and quits if connection fails
  2676. '*          Calls component.showResults() to display the page file
  2677. '*          details
  2678. '*
  2679. '******************************************************************************
  2680. Private Sub ProcessQuery(   ByVal strMachine,  _
  2681.                             ByVal strUserName, _
  2682.                             ByVal strPassword, _
  2683.                             ByVal strFormat,   _
  2684.                             ByVal blnSystemManaged, _
  2685.                             ByVal blnNoHeader  )
  2686.  
  2687.     ON ERROR RESUME NEXT
  2688.     Err.Clear
  2689.  
  2690.     Dim objEnumerator            ' to store the results of the query is executed
  2691.     Dim objInstance              ' to refer to the instances of the objEnumerator
  2692.     Dim strQuery                 ' to store the query obtained for given conditions
  2693.     Dim intTotSize               ' to store the total size on all drives
  2694.     Dim intRecommendedSize       ' to store the recommended size for all drives
  2695.     Dim arrResultsDrives         ' to store the columns of page file info.
  2696.     Dim arrHeaderDrives          ' to store the array header values
  2697.     Dim arrMaxLengthDrives       ' to store the maximum length for each column
  2698.     Dim arrFinalResultsDrives    ' used to send the arrResults to ShowResults()
  2699.     Dim intColumnCountDrives     ' number of columns to be displayed in the output
  2700.     Dim blnPrintHeaderDrives     ' variable which decides whether header is to be displayed or not
  2701.     Dim arrResultsSummary        ' to store the columns of page file info.
  2702.     Dim arrHeaderSummary         ' to store the array header values
  2703.     Dim arrMaxLengthSummary      ' to store the maximum length for each column
  2704.     Dim arrFinalResultsSummary   ' used to send the arrResults to ShowResults()
  2705.     Dim intColumnCountSummary    ' number of columns to be displayed in the output
  2706.     Dim blnPrintHeaderSummary    ' variable which decides whether header is to be displayed or not
  2707.     Dim objDiskDriveInstance     ' Instance for drive name
  2708.     Dim objMemSizeInstance       ' Instance for memory size
  2709.     Dim arrblnNoDisplayDrives    ' boolean variable for -noheader option
  2710.     Dim arrblnNoDisplaySummary   ' boolean variable for -noheader option
  2711.     Dim objService               ' service object
  2712.     Dim strDriveName             ' to store the drive name
  2713.     Dim objUsageInstance         ' Instance for PageFileUsage
  2714.  
  2715.     ' Initializing the blnPrintHeaders to true. Header should be printed by default
  2716.     blnPrintHeaderDrives = TRUE
  2717.     blnPrintHeaderSummary = TRUE
  2718.     intTotSize = 0
  2719.  
  2720.     If blnNoHeader Then
  2721.         blnPrintHeaderDrives = FALSE
  2722.         blnPrintHeaderSummary = FALSE
  2723.     End If
  2724.  
  2725.     ' Establish connection to WMI to get pagefile information
  2726.     If NOT component.wmiConnect(CONST_NAMESPACE_CIMV2 , _
  2727.                           strUserName , _
  2728.                           strPassword , _
  2729.                           strMachine  , _
  2730.                           blnLocalConnection , _
  2731.                           objService  ) Then
  2732.             WScript.Echo(L_HintCheckConnection_Message)
  2733.             WScript.Quit(EXIT_METHOD_FAIL)
  2734.     End If
  2735.  
  2736.     arrHeaderDrives = Array(L_ColHeaderHostname_Text   , L_ColHeaderDrive_Text, _
  2737.                             L_ColHeaderVolumeLabel_Text, L_ColHeaderFileName_Text, _
  2738.                             L_ColHeaderInitialSize_Text, L_ColHeaderMaximumSize_Text, _
  2739.                             L_ColHeaderCurrentSize_Text, L_ColHeaderFreeSpace_Text,_
  2740.                             L_ColHeaderPageFileStatus_Text)
  2741.  
  2742.     arrHeaderSummary = Array(L_ColHeaderHostname_Text, L_ColHeaderTotalMinimumSize_Text, _
  2743.                              L_ColHeaderTotalRecommendedSize_Text, L_ColHeaderTotalSize_Text)
  2744.  
  2745.     ' Data Lengths  = (15,13,13,19,20,20,20,22)
  2746.     arrMaxLengthDrives  = Array(L_CONST_HOSTNAME_Length_Text, L_CONST_DRIVENAME_Length_Text, L_CONST_VOLLABEL_Length_Text, _
  2747.                                 L_CONST_PAGEFILENAME_Length_Text, L_CONST_INTSIZE_Length_Text, L_CONST_MAXSIZE_Length_Text, _
  2748.                                 L_CONST_CURRENTSIZE_Length_Text, L_CONST_FREESPACE_Length_Text, _
  2749.                                 L_ColHeaderPageFileStatusLength_Text)
  2750.  
  2751.     ' Data Lengths  = (15,33,37,40)
  2752.     arrMaxLengthSummary = Array(L_CONST_HOSTNAME_Length_Text, L_CONST_TOTALMINSIZE_Length_Text,_
  2753.                                 L_CONST_TOTALRECSIZE_Length_Text, L_CONST_TOTALSIZE_Length_Text)
  2754.  
  2755.     arrblnNoDisplayDrives  = Array(0,0,0,0,0,0,0,0,0)
  2756.     arrblnNoDisplaySummary = Array(0,0,0,0)
  2757.  
  2758.     ' first initialize the array with N/A
  2759.     arrResultsDrives  = Array(L_Na_Text,L_Na_Text,L_Na_Text,L_Na_Text,L_Na_Text,L_Na_Text,_
  2760.                               L_Na_Text,L_Na_Text, L_Na_Text)
  2761.     arrResultsSummary = Array(L_Na_Text,L_Na_Text,L_Na_Text,L_Na_Text)
  2762.  
  2763.     ' build the query
  2764.     strQuery = "SELECT * FROM " & CLASS_PAGE_FILE_SETTING
  2765.  
  2766.     ' execute the query
  2767.     Set objEnumerator = objService.ExecQuery(strQuery, "WQL", 0, null)
  2768.     ' check for any errors
  2769.     If Err.Number Then
  2770.         Err.Clear
  2771.         WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  2772.         WScript.Quit(EXIT_QUERY_FAIL)
  2773.     End If
  2774.  
  2775.     ' If no.of pagefile instances are 0 (zero)
  2776.     If (objEnumerator.Count = 0) Then
  2777.         WScript.Echo(L_NoPageFiles_Message)
  2778.         WScript.Quit(EXIT_UNEXPECTED)
  2779.     End If
  2780.  
  2781.     ReDim arrFinalResultsDrives(0)
  2782.     ReDim arrFinalResultsSummary(0)
  2783.  
  2784.     If(LCase(strFormat) <> "csv") Then
  2785.         WScript.Echo("") ' Blank Line
  2786.     End If
  2787.  
  2788.     ' Loop through all the instances for the first report
  2789.     For each objInstance in objEnumerator
  2790.  
  2791.         If NOT IsEmpty(objInstance.Name) Then
  2792.             strDriveName = Mid(objInstance.Name,1,2)
  2793.         End If
  2794.  
  2795.         ' check if it is a valid physical drive
  2796.         If IsValidPhysicalDrive(objService,strDriveName) Then
  2797.  
  2798.             If IsEmpty(objInstance.Name) Then
  2799.                 arrResultsDrives(1) = L_Na_Text
  2800.             Else
  2801.                 strDriveName = Mid(objInstance.Name,1,2)
  2802.                 arrResultsDrives(1) = UCase(strDriveName)
  2803.             End If
  2804.  
  2805.             ' to get the data from Win32_PageFileUsage
  2806.             Set objUsageInstance = objService.Get(CLASS_PAGE_FILE_USAGE & "='" & objInstance.Name & "'")
  2807.  
  2808.             ' to get the current size
  2809.             If Len(objUsageInstance.AllocatedBaseSize) = 0 Then
  2810.                 arrResultsDrives(6) = L_Na_Text
  2811.             Else
  2812.                 arrResultsDrives(6) = objUsageInstance.AllocatedBaseSize & MEGA_BYTES
  2813.                 intTotSize = intTotSize + objUsageInstance.AllocatedBaseSize
  2814.             End If
  2815.  
  2816.             ' To set the PageFile status field
  2817.             If (objInstance.InitialSize = 0 AND objInstance.MaximumSize = 0) Then
  2818.                  arrResultsDrives(8) = L_CONST_System_Managed_Text
  2819.             Else
  2820.                  arrResultsDrives(8) = L_Custom_Text
  2821.             End If
  2822.  
  2823.  
  2824.             ' to get the data from Win32_LogicalDisk
  2825.             Set objDiskDriveInstance = objService.Get(CLASS_LOGICAL_DISK & "='" & strDriveName & "'")
  2826.  
  2827.             If Len(objDiskDriveInstance.VolumeName) = 0 Then
  2828.                 arrResultsDrives(2) = L_Na_Text
  2829.             Else
  2830.                 arrResultsDrives(2) = objDiskDriveInstance.VolumeName
  2831.             End If
  2832.  
  2833.             If Len(objDiskDriveInstance.SystemName) = 0 Then
  2834.                 arrResultsDrives(0) = L_Na_Text
  2835.             Else
  2836.                 arrResultsDrives(0) = objDiskDriveInstance.SystemName
  2837.                 arrResultsSummary(0) = objDiskDriveInstance.SystemName
  2838.             End If
  2839.  
  2840.             If (objDiskDriveInstance.FreeSpace) Then
  2841.                 arrResultsDrives(7) = Int(objDiskDriveInstance.FreeSpace/CONVERSION_FACTOR) + Int(objUsageInstance.AllocatedBaseSize) &_
  2842.                 MEGA_BYTES
  2843.             Else
  2844.                 arrResultsDrives(7) = L_Na_Text
  2845.             End If
  2846.  
  2847.             If IsEmpty(objInstance.Name) Then
  2848.                 arrResultsDrives(3) = L_Na_Text
  2849.             Else
  2850.                 arrResultsDrives(3) = objInstance.Name
  2851.             End If
  2852.  
  2853.             If objInstance.InitialSize Then
  2854.                 arrResultsDrives(4) = objInstance.InitialSize & MEGA_BYTES
  2855.             Else
  2856.                 arrResultsDrives(4) = L_Na_Text
  2857.             End If
  2858.  
  2859.             If objInstance.MaximumSize Then
  2860.                 arrResultsDrives(5) = objInstance.MaximumSize & MEGA_BYTES
  2861.             Else
  2862.                 arrResultsDrives(5) = L_Na_Text
  2863.             End If
  2864.  
  2865.             arrFinalResultsDrives(0) = arrResultsDrives
  2866.         
  2867.  
  2868.             Call component.showResults(arrHeaderDrives, arrFinalResultsDrives, arrMaxLengthDrives, _
  2869.                                        strFormat, blnPrintHeaderDrives, arrblnNoDisplayDrives)
  2870.             blnPrintHeaderDrives = FALSE
  2871.  
  2872.         End If
  2873.  
  2874.     Next
  2875.     WScript.Echo("")
  2876.  
  2877.     ' Display the summary report
  2878.     arrResultsSummary(1) = INITIAL_SIZE_LB & MEGA_BYTES
  2879.     Set objMemSizeInstance = objService.Get(CLASS_COMPUTER_SYSTEM & "='" & arrResultsDrives(0) & "'")
  2880.     If objMemSizeInstance.TotalPhysicalMemory Then
  2881.         intRecommendedSize = Int(Int(objMemSizeInstance.TotalPhysicalMemory/CONVERSION_FACTOR)* SIZE_FACTOR)
  2882.         arrResultsSummary(2) = intRecommendedSize & MEGA_BYTES
  2883.     Else
  2884.         arrResultsSummary(2) = L_Na_Text
  2885.     End If
  2886.  
  2887.     arrResultsSummary(3) = intTotSize & MEGA_BYTES
  2888.     arrFinalResultsSummary(0) = arrResultsSummary
  2889.  
  2890.     Call component.showResults(arrHeaderSummary, arrFinalResultsSummary, arrMaxLengthSummary, strFormat, _
  2891.                                blnPrintHeaderSummary,arrblnNoDisplaySummary)
  2892.     blnPrintHeaderSummary = FALSE
  2893.  
  2894. End Sub
  2895.  
  2896. '******************************************************************************
  2897. '* Function: IsValidPhysicalDrive
  2898. '*
  2899. '* Purpose:  To check if the specified drive is a valid physical drive.
  2900. '*           This check is done only for Win2K builds 
  2901. '*
  2902. '* Input:
  2903. '*  [in]     objServiceParam      service object to maintain wmi connection.
  2904. '*  [in]     strDriveName         drive name whose validity has to be checked.
  2905. '*
  2906. '* Output:   Returns TRUE or FALSE
  2907. '*             TRUE  - when the drive is a valid physical drive.
  2908. '*             FALSE - when the drive is not a valid physical drive.
  2909. '*
  2910. '******************************************************************************
  2911.  
  2912. Private Function IsValidPhysicalDrive ( ByVal objServiceParam, _
  2913.                                         ByVal strDriveName )
  2914.  
  2915.     ON ERROR RESUME NEXT
  2916.     Err.Clear
  2917.  
  2918.     CONST WIN2K_MAJOR_VERSION = 5000
  2919.     CONST WINXP_MAJOR_VERSION = 5001
  2920.  
  2921.     Dim strQuery            ' to store the query to be executed
  2922.     Dim objEnum             ' collection object
  2923.     Dim objInstance         ' instance object
  2924.     Dim strValidDrives      ' to store all valid physical drives
  2925.     Dim strVersion          ' to store the OS version
  2926.     Dim arrVersionElements  ' to store the OS version elements
  2927.     Dim CurrentMajorVersion ' the major version number
  2928.  
  2929.     strValidDrives = ""
  2930.     ' by default set it to true
  2931.     IsValidPhysicalDrive = TRUE
  2932.  
  2933.     strquery = "Select * From " & CLASS_OPERATING_SYSTEM
  2934.     set objEnum = objServiceParam.ExecQuery(strQuery,"WQL",48,null)
  2935.  
  2936.     For each objInstance in objEnum
  2937.         strVersion= objInstance.Version
  2938.     Next
  2939.  
  2940.     ' OS Version : 5.1.xxxx(Windows XP), 5.0.xxxx(Windows 2000)
  2941.     arrVersionElements  = split(strVersion,".")
  2942.     ' converting to major version
  2943.     CurrentMajorVersion = arrVersionElements(0) * 1000 + arrVersionElements(1)
  2944.  
  2945.     ' Determine the OS Type
  2946.     ' If the OS version is 5.1 or later, then NO NEED to validate.
  2947.     ' If the OS is Win2K, then validate the drive name.
  2948.     If CInt(CurrentMajorVersion) <= CInt(WINXP_MAJOR_VERSION) Then
  2949.  
  2950.         strQuery = "Select * From " & CLASS_PERFDISK_PHYSICAL_DISK
  2951.         Set objEnum = objServiceParam.ExecQuery(strQuery, "WQL", 0, null)
  2952.  
  2953.         For each objInstance in objEnum
  2954.             ' get all the instance except the last one
  2955.             If (objInstance.Name <> "_Total") Then
  2956.                 strValidDrives = strValidDrives & " " & objInstance.Name
  2957.             End If
  2958.         Next
  2959.  
  2960.         ' check if the specified drive is present in the list of valid physical drives
  2961.         If Instr(strValidDrives, UCase(strDriveName)) = 0 Then
  2962.             IsValidPhysicalDrive = FALSE
  2963.         End If
  2964.  
  2965.     End If
  2966.  
  2967. End Function
  2968.  
  2969.  
  2970. '******************************************************************************
  2971. '* Function: getFreeSpaceOnDisk
  2972. '*
  2973. '* Purpose:  To get the Free Space for the Specified Disk
  2974. '*
  2975. '* Input:
  2976. '*  [in]     strDriveName         drive name whose free space is needed 
  2977. '*  [in]     objServiceParam      service object to maintain wmi connection
  2978. '*
  2979. '* Output:   Returns the free space (in MB) on the specified disk.
  2980. '*
  2981. '******************************************************************************
  2982.  
  2983. Private Function getFreeSpaceOnDisk(ByVal strDriveName, ByVal objServiceParam)
  2984.  
  2985.     ON ERROR RESUME NEXT
  2986.     Err.Clear
  2987.  
  2988.     Dim objValidDiskInst
  2989.  
  2990.     Set objValidDiskInst = objServiceParam.Get(CLASS_LOGICAL_DISK & "='" & strDriveName & "'")
  2991.     If Err.Number Then
  2992.         Err.Clear
  2993.         WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  2994.     blnFailureMsg = TRUE
  2995.         QuitbasedonSuccess EXIT_QUERY_FAIL
  2996.     End If
  2997.  
  2998.     getFreeSpaceOnDisk = Int(objValidDiskInst.FreeSpace/CONVERSION_FACTOR)
  2999.  
  3000. End Function
  3001.  
  3002.  
  3003. '******************************************************************************
  3004. '* Function: getCurrentPageFileSize
  3005. '*
  3006. '* Purpose:  To get the current pagefile size on the specified drive
  3007. '*
  3008. '* Input:
  3009. '*  [in]     objService       wbem service object
  3010. '*  [in]     objInstance      instance of win32_pagefilesetting
  3011. '*
  3012. '* Output:   current pagefile size
  3013. '*
  3014. '******************************************************************************
  3015.  
  3016. Private Function getCurrentPageFileSize(ByVal objService, ByVal objInstance)
  3017.  
  3018.     ON ERROR RESUME NEXT
  3019.     Err.Clear
  3020.  
  3021.     Dim objUsageInstance
  3022.  
  3023.     ' get the data from Win32_PageFileUsage
  3024.     Set objUsageInstance = objService.Get(CLASS_PAGE_FILE_USAGE & "='" & objInstance.Name & "'")
  3025.  
  3026.     ' return the current size ( allocated base size )
  3027.     getCurrentPageFileSize = objUsageInstance.AllocatedBaseSize
  3028.  
  3029. End Function
  3030.  
  3031.  
  3032. '******************************************************************************
  3033. '* Function: GetDiskSize
  3034. '*
  3035. '* Purpose:  To get the disk size for the specified drive
  3036. '*
  3037. '* Input:
  3038. '*  [in]     strDriveName         drive name whose free space is needed
  3039. '*  [in]     objServiceParam      service object to maintain wmi connection
  3040. '*
  3041. '* Output:   Returns the total disk size in MB.
  3042. '*
  3043. '******************************************************************************
  3044.  
  3045. Private Function GetDiskSize(ByVal strDriveName, ByVal objServiceParam)
  3046.  
  3047.     ON ERROR RESUME NEXT
  3048.     Err.Clear
  3049.  
  3050.     Dim objValidDiskInst      ' object to store valid disk name 
  3051.  
  3052.     Set objValidDiskInst = objServiceParam.Get(CLASS_LOGICAL_DISK & "='" & strDriveName & "'")
  3053.  
  3054.     If Err.Number Then
  3055.         Err.Clear
  3056.         WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  3057.     blnFailureMsg = TRUE
  3058.         QuitBasedOnSuccess EXIT_QUERY_FAIL
  3059.     End If
  3060.  
  3061.     GetDiskSize = Int(objValidDiskInst.Size / CONVERSION_FACTOR)
  3062.  
  3063. End Function
  3064.  
  3065.  
  3066. '******************************************************************************
  3067. '* Function: GetPhysicalMemorySize
  3068. '*
  3069. '* Purpose:  To get the physical memory size.
  3070. '*
  3071. '* Input:
  3072. '*  [in]     strHostName              host name to connect to
  3073. '*  [in]     objServiceParam          service object to maintain wmi connection
  3074. '*
  3075. '* Output:   Returns the physical memory size in MB.
  3076. '*
  3077. '******************************************************************************
  3078.  
  3079. Private Function GetPhysicalMemorySize( ByVal strHostName, ByVal objServiceParam )
  3080.  
  3081.     ON ERROR RESUME NEXT
  3082.     Err.Clear
  3083.  
  3084.     Dim objMemSizeInstance          ' to store memory size
  3085.     Dim intReturnValue              ' to store return value
  3086.  
  3087.     Set objMemSizeInstance = objServiceParam.Get(CLASS_COMPUTER_SYSTEM & "='" & strHostName & "'")
  3088.     If Err.Number Then
  3089.         Err.Clear
  3090.         WScript.Echo L_UnableToRetrieveInfo_ErrorMessage
  3091.     blnFailureMsg = TRUE
  3092.         QuitBasedOnSuccess EXIT_QUERY_FAIL
  3093.     End If
  3094.  
  3095.     If objMemSizeInstance.TotalPhysicalMemory Then
  3096.         intReturnValue = Int(objMemSizeInstance.TotalPhysicalMemory/CONVERSION_FACTOR)
  3097.         GetPhysicalMemorySize = intReturnValue
  3098.     End If
  3099.  
  3100. End Function
  3101.  
  3102.  
  3103. '******************************************************************************
  3104. '* Function: getMaxSizeUB
  3105. '*
  3106. '* Purpose:  To get the allowed upper bound for maximum size
  3107. '*
  3108. '* Input:
  3109. '*  [in]     objServiceParam          service object to maintain wmi connection
  3110. '*
  3111. '* Output:   Returns the upper bound for maximum size
  3112. '*
  3113. '******************************************************************************
  3114.  
  3115. Private Function getMaxSizeUB(objServiceParam)
  3116.  
  3117.     ON ERROR RESUME NEXT
  3118.     Err.Clear
  3119.  
  3120.     CONST PROCESSOR_X86_BASED  = "X86"
  3121.     CONST PROCESSOR_IA64_BASED = "IA64"
  3122.  
  3123.     Dim objInstance         ' object instance
  3124.     Dim intReturnValue      ' to store return value
  3125.     Dim strProcessorType    ' to store the processor type
  3126.     Dim strQuery            ' to store the query
  3127.     Dim objEnum             ' collection of objects
  3128.  
  3129.     getMaxSizeUB     = 0
  3130.  
  3131.     strQuery = "Select * From " & CLASS_COMPUTER_SYSTEM
  3132.  
  3133.     Set objEnum = objServiceParam.ExecQuery(strQuery,"WQL",48,null)
  3134.     If Err.Number Then
  3135.         Err.Clear
  3136.         WScript.Echo L_UnableToRetrieveInfo_ErrorMessage
  3137.     blnFailureMsg = TRUE
  3138.         QuitBasedOnSuccess EXIT_QUERY_FAIL
  3139.     End If
  3140.  
  3141.     ' The following code will handle only single processor environment
  3142.  
  3143.     For each objInstance in objEnum
  3144.         strProcessorType = objInstance.SystemType
  3145.     Next
  3146.  
  3147.     ' check if its a 32-bit processor
  3148.     If InStr( UCase(strProcessorType),PROCESSOR_X86_BASED ) > 0 Then
  3149.         getMaxSizeUB = 4096
  3150.     End If
  3151.  
  3152.     ' check if its a 64-bit processor
  3153.     If Instr( UCase(strProcessorType),PROCESSOR_IA64_BASED ) > 0 Then
  3154.         getMaxSizeUB = 33554432
  3155.     End If
  3156.  
  3157. End Function
  3158.  
  3159. '******************************************************************************
  3160. '* Function: GetCrashDumpSetting
  3161. '*
  3162. '* Purpose:  To get the Crash Dump Settings for the machine specified
  3163. '*
  3164. '* Input:
  3165. '*  [in]    strUserNameParam        user name to connect to the machine
  3166. '*  [in]    strPasswordParam        password for the user
  3167. '*  [in]    strMachineParam         machine to get crash dump settings for
  3168. '*
  3169. '* Output:  Returns the current crash dump setting value [ 0,1,2,3 ]
  3170. '*            0 - None
  3171. '*            1 - Complete Memory Dump
  3172. '*            2 - Kernel Memory Dump
  3173. '*            3 - Small Memory Dump
  3174. '*
  3175. '******************************************************************************
  3176.  
  3177. Private Function GetCrashDumpSetting( ByVal strUserNameParam, _
  3178.                                       ByVal strPasswordParam, _
  3179.                                       ByVal strMachineParam   )
  3180.  
  3181.     ON ERROR RESUME NEXT
  3182.     Err.Clear
  3183.  
  3184.     CONST CONST_NAMESPACE_DEFAULT     = "root\default"      ' name space to connect to
  3185.     CONST CONST_HKEY_LOCAL_MACHINE    = 2147483650          ' registry value for HKEY_LOCAL_MACHINE
  3186.     CONST CONST_KEY_VALUE_NAME        = "CrashDumpEnabled"  ' value name to be retrieved
  3187.     CONST CONST_STD_REGISTRY_PROVIDER = "StdRegProv"        ' standard registry provider
  3188.     ' the Sub Key Name
  3189.     CONST CONST_CRASH_DUMP_REGKEY     = "SYSTEM\CurrentControlSet\Control\CrashControl"
  3190.  
  3191.     Dim objInstance          ' to store the object instance
  3192.     Dim objService           ' service object
  3193.     Dim intCrashDumpValue    ' to store the crash dump setting value
  3194.     Dim intReturnVal         ' to store return value
  3195.  
  3196.     ' connect to the WMI name space
  3197.     If NOT component.wmiConnect(CONST_NAMESPACE_DEFAULT , _
  3198.                       strUserNameParam   , _
  3199.                       strPasswordParam   , _
  3200.                       strMachineParam    , _
  3201.                       blnLocalConnection , _
  3202.                       objService  ) Then
  3203.         WScript.Echo(L_HintCheckConnection_Message)
  3204.     blnFailureMsg = TRUE
  3205.         QuitBasedOnSuccess EXIT_METHOD_FAIL
  3206.     End If
  3207.  
  3208.     ' get the instance of the Standard Registry Provider
  3209.     Set objInstance = objService.Get(CONST_STD_REGISTRY_PROVIDER)
  3210.  
  3211.     ' get the key value for from the registry
  3212.     intReturnVal = objInstance.GetDWORDValue( CONST_HKEY_LOCAL_MACHINE, _
  3213.                                               CONST_CRASH_DUMP_REGKEY, _
  3214.                                               CONST_KEY_VALUE_NAME, _
  3215.                                               intCrashDumpValue )
  3216.     ' check if any error has occured
  3217.     If Err.Number <> 0 Then
  3218.         Err.Clear
  3219.         WScript.Echo(L_FailCreateObject_ErrorMessage)
  3220.     blnFailureMsg = TRUE
  3221.         QuitBasedOnSuccess EXIT_INVALID_PARAM
  3222.     End If
  3223.  
  3224.     ' check for the return value after registry is accessed.
  3225.     If intReturnVal = 0 Then
  3226.         GetCrashDumpSetting = CInt(intCrashDumpValue)
  3227.     Else
  3228.         WScript.Echo(L_FailCreateObject_ErrorMessage)
  3229.     blnFailureMsg = TRUE
  3230.         QuitBasedOnSuccess EXIT_INVALID_PARAM
  3231.     End If
  3232.  
  3233. End Function
  3234.  
  3235.  
  3236. ' Function used to get the reply in y/n from the user
  3237. '******************************************************************************
  3238. '* Function: getReply
  3239. '*
  3240. '* Purpose:  To get reply from the user
  3241. '*
  3242. '* Input:    None
  3243. '*
  3244. '* Output:   Prompts for a warning message and accepts the user's choice [y/n]
  3245. '*           
  3246. '******************************************************************************
  3247. Private Function getReply()
  3248.  
  3249.     ON ERROR RESUME NEXT
  3250.     Err.Clear
  3251.  
  3252.     Dim objStdIn     ' to store value from standard input
  3253.     Dim strReply     ' to store the user reply
  3254.  
  3255.     WScript.Echo(L_PromptForContinueAnyWay_Message)
  3256.  
  3257.     Set objStdIn = WScript.StdIn
  3258.     
  3259.     If Err.Number Then
  3260.         Err.Clear
  3261.         WScript.Echo(L_FailCreateObject_ErrorMessage)
  3262.     blnFailureMsg = TRUE
  3263.         QuitBasedOnSuccess EXIT_INVALID_PARAM
  3264.     End If
  3265.  
  3266.     strReply = objStdIn.ReadLine()
  3267.     getReply = Trim(strReply)
  3268.  
  3269. End Function
  3270.  
  3271.  
  3272. '******************************************************************************
  3273. '* Function: isCrashDumpValueSet
  3274. '*
  3275. '* Purpose:  To check if the crash dump value is set
  3276. '*
  3277. '* Input:
  3278. '*  [in]     intCrashDumpParam       crash dump setting value
  3279. '*  [in]     intIntSizeParam         initial size of the pagefile
  3280. '*  [in]     intMemSizeParam         physical memory size
  3281. '*  [in]     strVolume               drive/volume name
  3282. '*
  3283. '* Output:   Returns TRUE or FALSE
  3284. '*
  3285. '******************************************************************************
  3286.  
  3287. Private Function isCrashDumpValueSet( ByVal intCrashDumpParam,_
  3288.                                       ByVal intIntSizeParam,  _
  3289.                                       ByVal intMemSizeParam,  _
  3290.                                       ByVal strVolume )
  3291.  
  3292.     ON ERROR RESUME NEXT
  3293.     Err.Clear
  3294.  
  3295.     ' Constants for Crash Dump Settings
  3296.     CONST NO_MEMORY_DUMP       = 0
  3297.     CONST COMPLETE_MEMORY_DUMP = 1
  3298.     CONST KERNEL_MEMORY_DUMP   = 2
  3299.     CONST SMALL_MEMORY_DUMP    = 3
  3300.  
  3301.     Dim strReply        ' to store user reply
  3302.     Dim intSizeValue    ' to store the size value used for comparison
  3303.  
  3304.     ' default value is NO [n]
  3305.     strReply = L_UserReplyNo_Text
  3306.  
  3307.     Select Case CInt(intCrashDumpParam)
  3308.  
  3309.         Case COMPLETE_MEMORY_DUMP
  3310.             If CInt(intIntSizeParam) < CInt(intMemSizeParam) Then
  3311.                 component.VBPrintf CrashDumpSettingWarningMessage, Array(UCase(strVolume),CInt(intMemSizeParam) & MEGA_BYTES)
  3312.                 ' Ask for choice until a yes[y] or no[n] is given
  3313.                 Do
  3314.                     strReply = getReply()
  3315.                     If Trim(LCase(strReply)) = L_UserReplyYes_Text Then
  3316.                         isCrashDumpValueSet = TRUE
  3317.                     ElseIf Trim(LCase(strReply)) = L_UserReplyNo_Text Then
  3318.                         isCrashDumpValueSet = FALSE
  3319.                     Else
  3320.                         WScript.Echo(L_InvalidUserReply_ErrorMessage)
  3321.                     End If
  3322.                 Loop Until (Trim(LCase(strReply)) = L_UserReplyYes_Text OR Trim(LCase(strReply)) = L_UserReplyNo_Text)
  3323.             Else
  3324.                 isCrashDumpValueSet = TRUE
  3325.             End If
  3326.  
  3327.         Case KERNEL_MEMORY_DUMP
  3328.  
  3329.             ' check if RAM size is less than or equal to 128 MB
  3330.             If CInt(intMemSizeParam) <= 128 Then
  3331.                 ' assign size value to be checked to 50 MB
  3332.                 intSizeValue = 50
  3333.             Else
  3334.                 ' check if RAM size is less than or equal to 4 GB
  3335.                 If CInt(intMemSizeParam) <= 4096 Then
  3336.                     ' assign size value to be checked to 200 MB
  3337.                     intSizeValue = 200
  3338.                 Else
  3339.                     ' check if RAM size is less than or equal to 8 GB
  3340.                     If CInt(intMemSizeParam) <= 8192 Then
  3341.                         ' assign size value to be checked to 400 MB
  3342.                         intSizeValue = 400
  3343.                     Else
  3344.                         ' assign size value to be checked to 800 MB
  3345.                         intSizeValue = 800
  3346.                     End If
  3347.                 End If
  3348.             End If
  3349.  
  3350.             If CInt(intIntSizeParam) < CInt(intSizeValue) Then
  3351.                 component.VBPrintf CrashDumpSettingWarningMessage, Array(UCase(strVolume),intSizeValue & MEGA_BYTES)
  3352.                 ' Ask for choice until a yes[y] or no[n] is given
  3353.                 Do
  3354.                     strReply = getReply()
  3355.                     If Trim(LCase(strReply)) = L_UserReplyYes_Text Then
  3356.                         isCrashDumpValueSet = TRUE
  3357.                     ElseIf Trim(LCase(strReply)) = L_UserReplyNo_Text Then
  3358.                         isCrashDumpValueSet = FALSE
  3359.                     Else
  3360.                         WScript.Echo(L_InvalidUserReply_ErrorMessage)
  3361.                     End If
  3362.                 Loop Until (Trim(LCase(strReply)) = L_UserReplyYes_Text OR Trim(LCase(strReply)) = L_UserReplyNo_Text)
  3363.             Else
  3364.                 isCrashDumpValueSet = TRUE
  3365.             End If
  3366.  
  3367.         Case SMALL_MEMORY_DUMP
  3368.  
  3369.             ' initial size should not be less than 64 KB ( less than or equal to 0 MB )
  3370.             If CInt(intIntSizeParam) <= 0 Then
  3371.                 component.VBPrintf CrashDumpSettingWarningMessage, Array(UCase(strVolume),"64 KB")
  3372.                 ' Ask for choice until a yes[y] or no[n] is given
  3373.                 Do
  3374.                     strReply = getReply()
  3375.                     If Trim(LCase(strReply)) = L_UserReplyYes_Text Then
  3376.                         isCrashDumpValueSet = TRUE
  3377.                     ElseIf Trim(LCase(strReply)) = L_UserReplyNo_Text Then
  3378.                         isCrashDumpValueSet = FALSE
  3379.                     Else
  3380.                         WScript.Echo(L_InvalidUserReply_ErrorMessage)
  3381.                     End If
  3382.                 Loop Until (Trim(LCase(strReply)) = L_UserReplyYes_Text OR Trim(LCase(strReply)) = L_UserReplyNo_Text)
  3383.             Else
  3384.                 isCrashDumpValueSet = TRUE
  3385.             End If
  3386.  
  3387.         Case NO_MEMORY_DUMP
  3388.  
  3389.             ' Crash Dump values 0 has no problem
  3390.             isCrashDumpValueSet = TRUE
  3391.  
  3392.     End Select
  3393.  
  3394. End Function
  3395.  
  3396. '*******************************************************************************
  3397. '* sub:     QuitBasedOnSuccess
  3398. '*
  3399. '* purpose: To quit the script based on the partial success of the operations
  3400. '*
  3401. '* Input:    intReturnVal  - Return value to be returned
  3402. '*
  3403. '******************************************************************************
  3404. sub QuitBasedOnSuccess(Byval intReturnVal )
  3405.     ON ERROR RESUME NEXT
  3406.     Err.Clear
  3407.  
  3408.  
  3409.     ' Prompt for reboot if at least one operation was successful.
  3410.     If blnSuccessMsg = TRUE Then
  3411.     WScript.Echo L_RestartComputer_Message
  3412.     End If
  3413.     
  3414.     ' If zero has to be returned, return based on the failure status
  3415.     If intReturnVal = EXIT_SUCCESS Then
  3416.     If blnFailureMsg = TRUE Then
  3417.         Wscript.Quit( EXIT_PARTIAL_SUCCESS )
  3418.     Else
  3419.         Wscript.Quit( EXIT_SUCCESS )
  3420.     End If
  3421.  
  3422.     'If other return levels are to be returned, just chck success value to return partial success value
  3423.     Else
  3424.     If blnSuccessMsg = TRUE Then
  3425.         Wscript.Quit( EXIT_PARTIAL_SUCCESS )
  3426.     Else
  3427.         Wscript.Quit( intReturnVal)
  3428.     End If
  3429.     End If
  3430.  
  3431. End sub
  3432.  
  3433. '******************************************************************************
  3434. '* Sub:     typeMessage
  3435. '*
  3436. '* Purpose: To print the type usage messages relevent to the main option 
  3437. '*          selected.
  3438. '*
  3439. '* Input:   The main option selected.
  3440. '*
  3441. '* Output:  Prints "type..usage" messages for the main option selected.
  3442. '*
  3443. '******************************************************************************
  3444.  
  3445. Sub typeMessage(ByVal intMainOption)
  3446.  
  3447.     ON ERROR RESUME NEXT
  3448.     Err.Clear
  3449.  
  3450.     Select Case CInt(intMainOption)
  3451.  
  3452.         Case CONST_CHANGE_OPTION
  3453.             component.VBPrintf L_TypeChangeUsage_Message,Array(UCase(WScript.ScriptName))
  3454.         Case CONST_CREATE_OPTION
  3455.             component.VBPrintf L_TypeCreateUsage_Message,Array(UCase(WScript.ScriptName))
  3456.         Case CONST_DELETE_OPTION
  3457.             component.VBPrintf L_TypeDeleteUsage_Message,Array(UCase(WScript.ScriptName))
  3458.         Case CONST_QUERY_OPTION
  3459.             component.VBPrintf L_TypeQueryUsage_Message,Array(UCase(WScript.ScriptName))
  3460.         Case Else
  3461.             component.VBPrintf L_TypeUsage_Message,Array(UCase(WScript.ScriptName))
  3462.  
  3463.     End Select
  3464.  
  3465. End Sub
  3466.  
  3467. '******************************************************************************
  3468. '* Function: ExpandEnvironmentString()
  3469. '*
  3470. '* Purpose:  This function expands the environment variables.
  3471. '*
  3472. '* Input:    [in]   strOriginalString the string that needs expansion.
  3473. '* Output:   Returns ExpandedEnvironmentString
  3474. '*
  3475. '******************************************************************************
  3476.  
  3477. Private Function ExpandEnvironmentString(ByVal strOriginalString)
  3478.  
  3479.     ON ERROR RESUME NEXT
  3480.     Err.Clear
  3481.  
  3482.     Dim ObjWshShell  ' Object to hold Shell.
  3483.  
  3484.     ' Create the shell object.
  3485.     Set ObjWshShell = CreateObject("WScript.Shell")
  3486.  
  3487.         If Err.Number Then
  3488.              WScript.Echo( L_FailCreateObject_ErrorMessage )
  3489.          blnFailureMsg = TRUE
  3490.              QuitBasedOnSuccess EXIT_METHOD_FAIL
  3491.         End If
  3492.  
  3493.     ' Return the string.
  3494.     ExpandEnvironmentString = ObjWshShell.ExpandEnvironmentStrings(strOriginalString)
  3495.  
  3496. End Function
  3497.  
  3498.  
  3499. '******************************************************************************
  3500. '* Sub:     ShowUsage
  3501. '*
  3502. '* Purpose: Shows the correct usage to the user.
  3503. '*
  3504. '* Input:   None
  3505. '*
  3506. '* Output:  Help messages are displayed on screen.
  3507. '*
  3508. '******************************************************************************
  3509. Sub ShowUsage()
  3510.  
  3511.     WScript.Echo vbCr                                   ' Line 1
  3512.     WScript.Echo( L_ShowUsageLine02_Text )              ' Line 2
  3513.     WScript.Echo vbCr                                   ' Line 3
  3514.     WScript.Echo( L_UsageDescription_Text )             ' Line 4
  3515.     WScript.Echo( L_ShowUsageLine05_Text )              ' Line 5
  3516.     WScript.Echo( L_ShowUsageLine06_Text )              ' Line 6
  3517.     WScript.Echo vbCr                                   ' Line 7
  3518.     WScript.Echo( L_ShowUsageLine08_Text )              ' Line 8
  3519.     WScript.Echo( L_ShowUsageLine09_Text )              ' Line 9
  3520.     WScript.Echo( L_ShowUsageLine10_Text )              ' Line 10
  3521.     WScript.Echo vbCr                                   ' Line 11
  3522.     WScript.Echo( L_ShowUsageLine12_Text )              ' Line 12
  3523.     WScript.Echo vbCr                                   ' Line 13
  3524.     WScript.Echo( L_ShowUsageLine14_Text )              ' Line 14
  3525.     WScript.Echo vbCr                                   ' Line 15
  3526.     WScript.Echo( L_ShowUsageLine16_Text )              ' Line 16
  3527.     WScript.Echo( L_ShowUsageLine17_Text )              ' Line 17
  3528.     WScript.Echo vbCr                                   ' Line 18
  3529.     WScript.Echo( L_ShowUsageLine19_Text )              ' Line 19
  3530.     WScript.Echo( L_ShowUsageLine20_Text )              ' Line 20
  3531.     WScript.Echo( L_ShowUsageLine21_Text )              ' Line 21
  3532.     WScript.Echo( L_ShowUsageLine22_Text )              ' Line 22
  3533.     WScript.Echo( L_ShowUsageLine23_Text )              ' Line 23
  3534.     WScript.Echo( L_ShowUsageLine24_Text )              ' Line 24
  3535.     WScript.Echo( L_ShowUsageLine25_Text )              ' Line 25
  3536.  
  3537. End Sub
  3538.  
  3539.  
  3540. '******************************************************************************
  3541. '* Sub:     ShowChangeUsage
  3542. '*
  3543. '* Purpose: Shows the correct usage to the user.
  3544. '*
  3545. '* Input:   None
  3546. '*
  3547. '* Output:  Help messages for the /Change o ption are displayed on screen.
  3548. '*
  3549. '******************************************************************************
  3550. Sub ShowChangeUsage()
  3551.  
  3552.     WScript.Echo vbCr                                   ' Line 1
  3553.     WScript.Echo( L_ShowChangeUsageLine02_Text )        ' Line 2
  3554.     WScript.Echo( L_ShowChangeUsageLine03_Text )        ' Line 3
  3555.     WScript.Echo( L_ShowChangeUsageLine04_Text )        ' Line 4
  3556.     WScript.Echo vbCr                                   ' Line 5
  3557.     WScript.Echo( L_UsageDescription_Text )             ' Line 6
  3558.     WScript.Echo( L_ShowChangeUsageLine07_Text )        ' Line 7
  3559.     WScript.Echo vbCr                                   ' Line 8
  3560.     WScript.Echo( L_UsageParamList_Text )               ' Line 9
  3561.     WScript.Echo( L_UsageMachineName_Text )             ' Line 10
  3562.     WScript.Echo vbCr                                   ' Line 11
  3563.     WScript.Echo( L_UsageUserNameLine1_Text )           ' Line 12
  3564.     WScript.Echo( L_UsageUserNameLine2_Text )           ' Line 13
  3565.     WScript.Echo vbCr                                   ' Line 14
  3566.     WScript.Echo( L_UsagePasswordLine1_Text )           ' Line 15
  3567.     WScript.Echo( L_UsagePasswordLine2_Text )           ' Line 16
  3568.     WScript.Echo vbCr                                   ' Line 17
  3569.     WScript.Echo( L_ShowChangeUsageLine18_Text )        ' Line 18
  3570.     WScript.Echo( L_ShowChangeUsageLine19_Text )        ' Line 19
  3571.     WScript.Echo vbCr                                   ' Line 20
  3572.     WScript.Echo( L_ShowChangeUsageLine21_Text )        ' Line 21
  3573.     WScript.Echo( L_ShowChangeUsageLine22_Text )        ' Line 22
  3574.     WScript.Echo vbCr                                   ' Line 23
  3575.     WScript.Echo( L_ShowChangeUsageLine24_Text )        ' Line 24
  3576.     WScript.Echo( L_ShowChangeUsageLine25_Text )        ' Line 25
  3577.     WScript.Echo vbCr                                   ' Line 26
  3578.     WScript.Echo( L_ShowChangeUsageLine27_Text )        ' Line 27
  3579.     WScript.Echo( L_ShowChangeUsageLine28_Text )        ' Line 28
  3580.     WScript.Echo( L_ShowChangeUsageLine29_Text )        ' Line 29
  3581.     WScript.Echo( L_ShowChangeUsageLine30_Text )        ' Line 30
  3582.     WScript.Echo vbCr                                   ' Line 31
  3583.     WScript.Echo( L_UsageExamples_Text )                ' Line 31
  3584.     WScript.Echo( L_ShowChangeUsageLine33_Text )        ' Line 33
  3585.     WScript.Echo( L_ShowChangeUsageLine34_Text )        ' Line 34
  3586.     WScript.Echo( L_ShowChangeUsageLine35_Text )        ' Line 35
  3587.     WScript.Echo( L_ShowChangeUsageLine36_Text )        ' Line 36
  3588.     WScript.Echo( L_ShowChangeUsageLine37_Text )        ' Line 37
  3589.     WScript.Echo( L_ShowChangeUsageLine38_Text )        ' Line 38
  3590.     WScript.Echo( L_ShowChangeUsageLine39_Text )        ' Line 39
  3591.  
  3592. End Sub
  3593.  
  3594.  
  3595. '******************************************************************************
  3596. '* Sub:     ShowCreateUsage
  3597. '*
  3598. '* Purpose: Shows the correct usage to the user.
  3599. '*
  3600. '* Input:   None
  3601. '*
  3602. '* Output:  Help messages for the /Create option are displayed on screen.
  3603. '*
  3604. '******************************************************************************
  3605. Sub ShowCreateUsage()
  3606.  
  3607.     WScript.Echo vbCr                                   ' Line 1
  3608.     WScript.Echo( L_ShowCreateUsageLine02_Text )        ' Line 2
  3609.     WScript.Echo( L_ShowCreateUsageLine03_Text )        ' Line 3
  3610.     WScript.Echo( L_ShowCreateUsageLine04_Text )        ' Line 4
  3611.     WScript.Echo vbCr                                   ' Line 5
  3612.     WScript.Echo( L_UsageDescription_Text )             ' Line 6
  3613.     WScript.Echo( L_ShowCreateUsageLine07_Text )        ' Line 7
  3614.     WScript.Echo vbCr                                   ' Line 8
  3615.     WScript.Echo( L_UsageParamList_Text )               ' Line 9
  3616.     WScript.Echo( L_UsageMachineName_Text )             ' Line 10
  3617.     WScript.Echo vbCr                                   ' Line 11
  3618.     WScript.Echo( L_UsageUserNameLine1_Text )           ' Line 12
  3619.     WScript.Echo( L_UsageUserNameLine2_Text )           ' Line 13
  3620.     WScript.Echo vbCr                                   ' Line 14
  3621.     WScript.Echo( L_UsagePasswordLine1_Text )           ' Line 15
  3622.     WScript.Echo( L_UsagePasswordLine2_Text )           ' Line 16
  3623.     WScript.Echo vbCr                                   ' Line 17
  3624.     WScript.Echo( L_ShowCreateUsageLine18_Text )        ' Line 18
  3625.     WScript.Echo( L_ShowCreateUsageLine19_Text )        ' Line 19
  3626.     WScript.Echo vbCr                                   ' Line 20
  3627.     WScript.Echo( L_ShowCreateUsageLine21_Text )        ' Line 21
  3628.     WScript.Echo( L_ShowCreateUsageLine22_Text )        ' Line 22
  3629.     WScript.Echo vbCr                                   ' Line 23
  3630.     WScript.Echo( L_ShowCreateUsageLine24_Text )        ' Line 24
  3631.     WScript.Echo( L_ShowCreateUsageLine25_Text )        ' Line 25
  3632.     WScript.Echo vbCr                                   ' Line 26
  3633.     WScript.Echo( L_ShowCreateUsageLine27_Text )        ' Line 27
  3634.     WScript.Echo( L_ShowCreateUsageLine28_Text )        ' Line 28
  3635.     WScript.Echo( L_ShowCreateUsageLine29_Text )        ' Line 29
  3636.     WScript.Echo( L_ShowCreateUsageLine30_Text )        ' Line 30
  3637.     WScript.Echo vbCr                                   ' Line 31
  3638.     WScript.Echo( L_UsageExamples_Text )                ' Line 32
  3639.     WScript.Echo( L_ShowCreateUsageLine33_Text )        ' Line 33
  3640.     WScript.Echo( L_ShowCreateUsageLine34_Text )        ' Line 34
  3641.     WScript.Echo( L_ShowCreateUsageLine35_Text )        ' Line 35
  3642.     WScript.Echo( L_ShowCreateUsageLine36_Text )        ' Line 36
  3643.     WScript.Echo( L_ShowCreateUsageLine37_Text )        ' Line 37
  3644.     WScript.Echo( L_ShowCreateUsageLine38_Text )        ' Line 38
  3645.     WScript.Echo( L_ShowCreateUsageLine39_Text )        ' Line 39
  3646.  
  3647. End Sub
  3648.  
  3649.  
  3650. '******************************************************************************
  3651. '* Sub:     ShowDeleteUsage
  3652. '*
  3653. '* Purpose: Shows the correct usage to the user.
  3654. '*
  3655. '* Input:   None
  3656. '*
  3657. '* Output:  Help messages for the /Delete option are displayed on screen.
  3658. '*
  3659. '******************************************************************************
  3660. Sub ShowDeleteUsage()
  3661.  
  3662.     WScript.Echo vbCr                                   ' Line 1
  3663.     WScript.Echo( L_ShowDeleteUsageLine02_Text )        ' Line 2
  3664.     WScript.Echo( L_ShowDeleteUsageLine03_Text )        ' Line 3
  3665.     WScript.Echo vbCr                                   ' Line 4
  3666.     WScript.Echo( L_UsageDescription_Text )             ' Line 5
  3667.     WScript.Echo( L_ShowDeleteUsageLine06_Text )        ' Line 6
  3668.     WScript.Echo vbCr                                   ' Line 7
  3669.     WScript.Echo( L_UsageParamList_Text )               ' Line 8
  3670.     WScript.Echo( L_UsageMachineName_Text )             ' Line 9
  3671.     WScript.Echo vbCr                                   ' Line 10
  3672.     WScript.Echo( L_UsageUserNameLine1_Text )           ' Line 11
  3673.     WScript.Echo( L_UsageUserNameLine2_Text )           ' Line 12
  3674.     WScript.Echo vbCr                                   ' Line 13
  3675.     WScript.Echo( L_UsagePasswordLine1_Text )           ' Line 14
  3676.     WScript.Echo( L_UsagePasswordLine2_Text )           ' Line 15
  3677.     WScript.Echo vbCr                                   ' Line 16
  3678.     WScript.Echo( L_ShowDeleteUsageLine17_Text )        ' Line 17
  3679.     WScript.Echo( L_ShowDeleteUsageLine18_Text )        ' Line 18
  3680.     WScript.Echo( L_ShowDeleteUsageLine19_Text )        ' Line 19
  3681.     WScript.Echo vbCr                                   ' Line 20
  3682.     WScript.Echo( L_UsageExamples_Text )                ' Line 21
  3683.     WScript.Echo( L_ShowDeleteUsageLine22_Text )        ' Line 22
  3684.     WScript.Echo( L_ShowDeleteUsageLine23_Text )        ' Line 23
  3685.     WScript.Echo( L_ShowDeleteUsageLine24_Text )        ' Line 24
  3686.     WScript.Echo( L_ShowDeleteUsageLine25_Text )        ' Line 25
  3687.  
  3688. End Sub
  3689.  
  3690.  
  3691. '******************************************************************************
  3692. '* Sub:     ShowQueryUsage
  3693. '*
  3694. '* Purpose: Shows the correct usage to the user.
  3695. '*
  3696. '* Input:   None
  3697. '*
  3698. '* Output:  Help messages for the /Query option are displayed on screen.
  3699. '*
  3700. '******************************************************************************
  3701. Sub ShowQueryUsage()
  3702.  
  3703.     WScript.Echo vbCr                                   ' Line 1
  3704.     WScript.Echo( L_ShowQueryUsageLine02_Text )         ' Line 2
  3705.     WScript.Echo( L_ShowQueryUsageLine03_Text )         ' Line 3
  3706.     WScript.Echo vbCr                                   ' Line 4
  3707.     WScript.Echo( L_UsageDescription_Text )             ' Line 5
  3708.     WScript.Echo( L_ShowQueryUsageLine06_Text )         ' Line 6
  3709.     WScript.Echo vbCr                                   ' Line 7
  3710.     WScript.Echo( L_UsageParamList_Text )               ' Line 8
  3711.     WScript.Echo( L_UsageMachineName_Text )             ' Line 9
  3712.     WScript.Echo vbCr                                   ' Line 10
  3713.     WScript.Echo( L_UsageUserNameLine1_Text )           ' Line 11
  3714.     WScript.Echo( L_UsageUserNameLine2_Text )           ' Line 12
  3715.     WScript.Echo vbCr                                   ' Line 13
  3716.     WScript.Echo( L_UsagePasswordLine1_Text )           ' Line 14
  3717.     WScript.Echo( L_UsagePasswordLine2_Text )           ' Line 15
  3718.     WScript.Echo vbCr                                   ' Line 16
  3719.     WScript.Echo( L_ShowQueryUsageLine17_Text )         ' Line 17
  3720.     WScript.Echo( L_ShowQueryUsageLine18_Text )         ' Line 18
  3721.     WScript.Echo( L_ShowQueryUsageLine19_Text )         ' Line 19
  3722.     WScript.Echo vbCr                                   ' Line 20
  3723.     WScript.Echo( L_ShowQueryUsageLine21_Text )         ' Line 21
  3724.     WScript.Echo( L_ShowQueryUsageLine22_Text )         ' Line 22
  3725.     WScript.Echo vbCr                                   ' Line 23
  3726.     WScript.Echo( L_UsageExamples_Text )                ' Line 24
  3727.     WScript.Echo( L_ShowQueryUsageLine25_Text )         ' Line 25
  3728.     WScript.Echo( L_ShowQueryUsageLine26_Text )         ' Line 26
  3729.     WScript.Echo( L_ShowQueryUsageLine27_Text )         ' Line 27
  3730.     WScript.Echo( L_ShowQueryUsageLine28_Text )         ' Line 28
  3731.     WScript.Echo( L_ShowQueryUsageLine29_Text )         ' Line 29
  3732.     WScript.Echo( L_ShowQueryUsageLine30_Text )         ' Line 30
  3733.     WScript.Echo( L_ShowQueryUsageLine31_Text )         ' Line 31
  3734. End Sub
  3735.  
  3736. '' SIG '' Begin signature block
  3737. '' SIG '' MIIaLwYJKoZIhvcNAQcCoIIaIDCCGhwCAQExDjAMBggq
  3738. '' SIG '' hkiG9w0CBQUAMGYGCisGAQQBgjcCAQSgWDBWMDIGCisG
  3739. '' SIG '' AQQBgjcCAR4wJAIBAQQQTvApFpkntU2P5azhDxfrqwIB
  3740. '' SIG '' AAIBAAIBAAIBAAIBADAgMAwGCCqGSIb3DQIFBQAEEHko
  3741. '' SIG '' YVpKucLx6zWsK5hurrSgghS8MIICvDCCAiUCEEoZ0jiM
  3742. '' SIG '' glkcpV1zXxVd3KMwDQYJKoZIhvcNAQEEBQAwgZ4xHzAd
  3743. '' SIG '' BgNVBAoTFlZlcmlTaWduIFRydXN0IE5ldHdvcmsxFzAV
  3744. '' SIG '' BgNVBAsTDlZlcmlTaWduLCBJbmMuMSwwKgYDVQQLEyNW
  3745. '' SIG '' ZXJpU2lnbiBUaW1lIFN0YW1waW5nIFNlcnZpY2UgUm9v
  3746. '' SIG '' dDE0MDIGA1UECxMrTk8gTElBQklMSVRZIEFDQ0VQVEVE
  3747. '' SIG '' LCAoYyk5NyBWZXJpU2lnbiwgSW5jLjAeFw05NzA1MTIw
  3748. '' SIG '' MDAwMDBaFw0wNDAxMDcyMzU5NTlaMIGeMR8wHQYDVQQK
  3749. '' SIG '' ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMRcwFQYDVQQL
  3750. '' SIG '' Ew5WZXJpU2lnbiwgSW5jLjEsMCoGA1UECxMjVmVyaVNp
  3751. '' SIG '' Z24gVGltZSBTdGFtcGluZyBTZXJ2aWNlIFJvb3QxNDAy
  3752. '' SIG '' BgNVBAsTK05PIExJQUJJTElUWSBBQ0NFUFRFRCwgKGMp
  3753. '' SIG '' OTcgVmVyaVNpZ24sIEluYy4wgZ8wDQYJKoZIhvcNAQEB
  3754. '' SIG '' BQADgY0AMIGJAoGBANMuIPBofCwtLoEcsQaypwu3EQ1X
  3755. '' SIG '' 2lPYdePJMyqy1PYJWzTz6ZD+CQzQ2xtauc3n9oixncCH
  3756. '' SIG '' Jet9WBBzanjLcRX9xlj2KatYXpYE/S1iEViBHMpxlNUi
  3757. '' SIG '' WC/VzBQFhDa6lKq0TUrp7jsirVaZfiGcbIbASkeXarSm
  3758. '' SIG '' NtX8CS3TtDmbAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEA
  3759. '' SIG '' YVUOPnvHkhJ+ERCOIszUsxMrW+hE5At4nqR+86cHch7i
  3760. '' SIG '' We/MhOOJlEzbTmHvs6T7Rj1QNAufcFb2jip/F87lY795
  3761. '' SIG '' aQdzLrCVKIr17aqp0l3NCsoQCY/Os68olsR5KYSS3P+6
  3762. '' SIG '' Z0JIppAQ5L9h+JxT5ZPRcz/4/Z1PhKxV0f0RY2MwggQC
  3763. '' SIG '' MIIDa6ADAgECAhAIem1cb2KTT7rE/UPhFBidMA0GCSqG
  3764. '' SIG '' SIb3DQEBBAUAMIGeMR8wHQYDVQQKExZWZXJpU2lnbiBU
  3765. '' SIG '' cnVzdCBOZXR3b3JrMRcwFQYDVQQLEw5WZXJpU2lnbiwg
  3766. '' SIG '' SW5jLjEsMCoGA1UECxMjVmVyaVNpZ24gVGltZSBTdGFt
  3767. '' SIG '' cGluZyBTZXJ2aWNlIFJvb3QxNDAyBgNVBAsTK05PIExJ
  3768. '' SIG '' QUJJTElUWSBBQ0NFUFRFRCwgKGMpOTcgVmVyaVNpZ24s
  3769. '' SIG '' IEluYy4wHhcNMDEwMjI4MDAwMDAwWhcNMDQwMTA2MjM1
  3770. '' SIG '' OTU5WjCBoDEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4x
  3771. '' SIG '' HzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdvcmsx
  3772. '' SIG '' OzA5BgNVBAsTMlRlcm1zIG9mIHVzZSBhdCBodHRwczov
  3773. '' SIG '' L3d3dy52ZXJpc2lnbi5jb20vcnBhIChjKTAxMScwJQYD
  3774. '' SIG '' VQQDEx5WZXJpU2lnbiBUaW1lIFN0YW1waW5nIFNlcnZp
  3775. '' SIG '' Y2UwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
  3776. '' SIG '' AQDAemGH67KnA2MbKxph3oC3FR2gi5A9uyeShBQ564XO
  3777. '' SIG '' KZIGZkikA0+N6E+n8K9e0S8Zx5HxtZ57kSHO6f/jTvD8
  3778. '' SIG '' r5VYuGMt5o72KRjNcI5Qw+2Wu0DbviXoQlXW9oXyBueL
  3779. '' SIG '' mRwx8wMP1EycJCrcGxuPgvOw76dN4xSn4I/Wx2jCYVip
  3780. '' SIG '' ctT4MEhP2S9vYyDZicqCe8JLvCjFgWjn5oJArEY6oPk/
  3781. '' SIG '' Ns1Mu1RCWnple/6E5MdHVKy5PeyAxxr3xDOBgckqlft/
  3782. '' SIG '' XjqHkBTbzC518u9r5j2pYL5CAapPqluoPyIxnxIV+XOh
  3783. '' SIG '' HoKLBCvqRgJMbY8fUC6VSyp4BoR0PZGPLEcxAgMBAAGj
  3784. '' SIG '' gbgwgbUwQAYIKwYBBQUHAQEENDAyMDAGCCsGAQUFBzAB
  3785. '' SIG '' hiRodHRwOi8vb2NzcC52ZXJpc2lnbi5jb20vb2NzcC9z
  3786. '' SIG '' dGF0dXMwCQYDVR0TBAIwADBEBgNVHSAEPTA7MDkGC2CG
  3787. '' SIG '' SAGG+EUBBwEBMCowKAYIKwYBBQUHAgEWHGh0dHBzOi8v
  3788. '' SIG '' d3d3LnZlcmlzaWduLmNvbS9ycGEwEwYDVR0lBAwwCgYI
  3789. '' SIG '' KwYBBQUHAwgwCwYDVR0PBAQDAgbAMA0GCSqGSIb3DQEB
  3790. '' SIG '' BAUAA4GBAC3zT2NgLBja9SQPUrMM67O8Z4XCI+2PRg3P
  3791. '' SIG '' Gk2+83x6IDAyGGiLkrsymfCTuDsVBid7PgIGAKQhkoQT
  3792. '' SIG '' CsWY5UBXxQUl6K+vEWqp5TvL6SP2lCldQFXzpVOdyDY6
  3793. '' SIG '' OWUIc3OkMtKvrL/HBTz/RezD6Nok0c5jrgmn++Ib4/1B
  3794. '' SIG '' CmqWMIIEEjCCAvqgAwIBAgIPAMEAizw8iBHRPvZj7N9A
  3795. '' SIG '' MA0GCSqGSIb3DQEBBAUAMHAxKzApBgNVBAsTIkNvcHly
  3796. '' SIG '' aWdodCAoYykgMTk5NyBNaWNyb3NvZnQgQ29ycC4xHjAc
  3797. '' SIG '' BgNVBAsTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEhMB8G
  3798. '' SIG '' A1UEAxMYTWljcm9zb2Z0IFJvb3QgQXV0aG9yaXR5MB4X
  3799. '' SIG '' DTk3MDExMDA3MDAwMFoXDTIwMTIzMTA3MDAwMFowcDEr
  3800. '' SIG '' MCkGA1UECxMiQ29weXJpZ2h0IChjKSAxOTk3IE1pY3Jv
  3801. '' SIG '' c29mdCBDb3JwLjEeMBwGA1UECxMVTWljcm9zb2Z0IENv
  3802. '' SIG '' cnBvcmF0aW9uMSEwHwYDVQQDExhNaWNyb3NvZnQgUm9v
  3803. '' SIG '' dCBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  3804. '' SIG '' DwAwggEKAoIBAQCpAr3BcOY78k4bKJ+XeF4w6qKpjSVf
  3805. '' SIG '' +P6VTKO3/p2iID58UaKboo9gMmvRQmR57qx2yVTa8uuc
  3806. '' SIG '' hhyPn4Rms8VremIj1h083g8BkuiWxL8tZpqaaCaZ0Dos
  3807. '' SIG '' vwy1WCbBRucKPjiWLKkoOajsSYNC44QPu5psVWGsgnyh
  3808. '' SIG '' YC13TOmZtGQ7mlAcMQgkFJ+p55ErGOY9mGMUYFgFZZ8d
  3809. '' SIG '' N1KH96fvlALGG9O/VUWziYC/OuxUlE6u/ad6bXROrxjM
  3810. '' SIG '' lgkoIQBXkGBpN7tLEgc8Vv9b+6RmCgim0oFWV++2O14W
  3811. '' SIG '' gXcE2va+roCV/rDNf9anGnJcPMq88AijIjCzBoXJsyB3
  3812. '' SIG '' E4XfAgMBAAGjgagwgaUwgaIGA1UdAQSBmjCBl4AQW9Bw
  3813. '' SIG '' 72lyniNRfhSyTY7/y6FyMHAxKzApBgNVBAsTIkNvcHly
  3814. '' SIG '' aWdodCAoYykgMTk5NyBNaWNyb3NvZnQgQ29ycC4xHjAc
  3815. '' SIG '' BgNVBAsTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEhMB8G
  3816. '' SIG '' A1UEAxMYTWljcm9zb2Z0IFJvb3QgQXV0aG9yaXR5gg8A
  3817. '' SIG '' wQCLPDyIEdE+9mPs30AwDQYJKoZIhvcNAQEEBQADggEB
  3818. '' SIG '' AJXoC8CN85cYNe24ASTYdxHzXGAyn54Lyz4FkYiPyTrm
  3819. '' SIG '' IfLwV5MstaBHyGLv/NfMOztaqTZUaf4kbT/JzKreBXzd
  3820. '' SIG '' MY09nxBwarv+Ek8YacD80EPjEVogT+pie6+qGcgrNyUt
  3821. '' SIG '' vmWhEoolD2Oj91Qc+SHJ1hXzUqxuQzIH/YIX+OVnbA1R
  3822. '' SIG '' 9r3xUse958Qw/CAxCYgdlSkaTdUdAqXxgOADtFv0sd3I
  3823. '' SIG '' V+5lScdSVLa0AygS/5DW8AiPfriXxas3LOR65Kh343ag
  3824. '' SIG '' ANBqP8HSNorgQRKoNWobats14dQcBOSoRQTIWjM4bk0c
  3825. '' SIG '' DWK3CqKM09VUP0bNHFWmcNsSOoeTdZ+n0qAwggTJMIID
  3826. '' SIG '' saADAgECAhBqC5lPwADeqhHU2ECaqL7mMA0GCSqGSIb3
  3827. '' SIG '' DQEBBAUAMHAxKzApBgNVBAsTIkNvcHlyaWdodCAoYykg
  3828. '' SIG '' MTk5NyBNaWNyb3NvZnQgQ29ycC4xHjAcBgNVBAsTFU1p
  3829. '' SIG '' Y3Jvc29mdCBDb3Jwb3JhdGlvbjEhMB8GA1UEAxMYTWlj
  3830. '' SIG '' cm9zb2Z0IFJvb3QgQXV0aG9yaXR5MB4XDTAwMTIxMDA4
  3831. '' SIG '' MDAwMFoXDTA1MTExMjA4MDAwMFowgaYxCzAJBgNVBAYT
  3832. '' SIG '' AlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQH
  3833. '' SIG '' EwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29y
  3834. '' SIG '' cG9yYXRpb24xKzApBgNVBAsTIkNvcHlyaWdodCAoYykg
  3835. '' SIG '' MjAwMCBNaWNyb3NvZnQgQ29ycC4xIzAhBgNVBAMTGk1p
  3836. '' SIG '' Y3Jvc29mdCBDb2RlIFNpZ25pbmcgUENBMIIBIDANBgkq
  3837. '' SIG '' hkiG9w0BAQEFAAOCAQ0AMIIBCAKCAQEAooQVU9gLMA40
  3838. '' SIG '' lf86G8LzL3ttNyNN89KM5f2v/cUCNB8kx+Wh3FTsfgJ0
  3839. '' SIG '' R6vbMlgWFFEpOPF+srSMOke1OU5uVMIxDDpt+83Ny1Cc
  3840. '' SIG '' G66n2NlKJj+1xcuPluJJ8m3Y6ZY+3gXP8KZVN60vYM2A
  3841. '' SIG '' YUKhSVRKDxi3S9mTmTBaR3VktNO73barDJ1PuHM7GDqq
  3842. '' SIG '' tIeMsIiwTU8fThG1M4DfDTpkb0THNL1Kk5u8ph35BSNO
  3843. '' SIG '' YCmPzCryhJqZrajbCnB71jRBkKW3ZsdcGx2jMw6bVAMa
  3844. '' SIG '' P5iQuMznPQR0QxyP9znms6xIemsqDmIBYTl2bv0+mAdL
  3845. '' SIG '' FPEBRv0VAOBH2k/kBeSAJQIBA6OCASgwggEkMBMGA1Ud
  3846. '' SIG '' JQQMMAoGCCsGAQUFBwMDMIGiBgNVHQEEgZowgZeAEFvQ
  3847. '' SIG '' cO9pcp4jUX4Usk2O/8uhcjBwMSswKQYDVQQLEyJDb3B5
  3848. '' SIG '' cmlnaHQgKGMpIDE5OTcgTWljcm9zb2Z0IENvcnAuMR4w
  3849. '' SIG '' HAYDVQQLExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xITAf
  3850. '' SIG '' BgNVBAMTGE1pY3Jvc29mdCBSb290IEF1dGhvcml0eYIP
  3851. '' SIG '' AMEAizw8iBHRPvZj7N9AMBAGCSsGAQQBgjcVAQQDAgEA
  3852. '' SIG '' MB0GA1UdDgQWBBQpXLkbts0z7rueWX335couxA00KDAZ
  3853. '' SIG '' BgkrBgEEAYI3FAIEDB4KAFMAdQBiAEMAQTALBgNVHQ8E
  3854. '' SIG '' BAMCAUYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0B
  3855. '' SIG '' AQQFAAOCAQEARVjimkF//J2/SHd3rozZ5hnFV7QavbS5
  3856. '' SIG '' XwKhRWo5Wfm5J5wtTZ78ouQ4ijhkIkLfuS8qz7fWBsrr
  3857. '' SIG '' Kr/gGoV821EIPfQi09TAbYiBFURfZINkxKmULIrbkDdK
  3858. '' SIG '' D7fo1GGPdnbh2SX/JISVjQRWVJShHDo+grzupYeMHIxL
  3859. '' SIG '' eV+1SfpeMmk6H1StdU3fZOcwPNtkSUT7+8QcQnHmoD1F
  3860. '' SIG '' 7msAn6xCvboRs1bk+9WiKoHYH06iVb4nj3Cmomwb/1SK
  3861. '' SIG '' gryBS6ahsWZ6qRenywbAR+ums+kxFVM9KgS//3NI3Isn
  3862. '' SIG '' Q/xj6O4kh1u+NtHoMfUy2V7feXq6MKxphkr7jBG/G41U
  3863. '' SIG '' WTCCBQ8wggP3oAMCAQICCmEHEUMAAAAAADQwDQYJKoZI
  3864. '' SIG '' hvcNAQEFBQAwgaYxCzAJBgNVBAYTAlVTMRMwEQYDVQQI
  3865. '' SIG '' EwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4w
  3866. '' SIG '' HAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xKzAp
  3867. '' SIG '' BgNVBAsTIkNvcHlyaWdodCAoYykgMjAwMCBNaWNyb3Nv
  3868. '' SIG '' ZnQgQ29ycC4xIzAhBgNVBAMTGk1pY3Jvc29mdCBDb2Rl
  3869. '' SIG '' IFNpZ25pbmcgUENBMB4XDTAyMDUyNTAwNTU0OFoXDTAz
  3870. '' SIG '' MTEyNTAxMDU0OFowgaExCzAJBgNVBAYTAlVTMRMwEQYD
  3871. '' SIG '' VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25k
  3872. '' SIG '' MR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24x
  3873. '' SIG '' KzApBgNVBAsTIkNvcHlyaWdodCAoYykgMjAwMiBNaWNy
  3874. '' SIG '' b3NvZnQgQ29ycC4xHjAcBgNVBAMTFU1pY3Jvc29mdCBD
  3875. '' SIG '' b3Jwb3JhdGlvbjCCASIwDQYJKoZIhvcNAQEBBQADggEP
  3876. '' SIG '' ADCCAQoCggEBAKqZvTmoGCf0Kz0LTD98dy6ny7XRjA3C
  3877. '' SIG '' OnTXk7XgoEs/WV7ORU+aeSnxScwaR+5Vwgg+EiD4VfLu
  3878. '' SIG '' X9Pgypa8MN7+WMgnMtCFVOjwkRC78yu+GeUDmwuGHfOw
  3879. '' SIG '' OYy4/QsdPHMmrFcryimiFZCCFeJ3o0BSA4udwnC6H+k0
  3880. '' SIG '' 9vM1kk5Vg/jaMLYg3lcGtVpCBt5Zy/Lfpr0VR3EZJSPS
  3881. '' SIG '' y2+bGXnfalvxdgV5KfzDVsqPRAiFVYrLyA9GS1XLjJZ3
  3882. '' SIG '' SofoqUEGx/8N6WhXY3LDaVe0Q88yOjDcG+nVQyYqef6V
  3883. '' SIG '' 2yJnJMkv0DTj5vtRSYa4PNAlX9bsngNhh6loQMf44gPm
  3884. '' SIG '' zwUCAwEAAaOCAUAwggE8MA4GA1UdDwEB/wQEAwIGwDAT
  3885. '' SIG '' BgNVHSUEDDAKBggrBgEFBQcDAzAdBgNVHQ4EFgQUa8jG
  3886. '' SIG '' USDwtC/ToLauf14msriHUikwgakGA1UdIwSBoTCBnoAU
  3887. '' SIG '' KVy5G7bNM+67nll99+XKLsQNNCihdKRyMHAxKzApBgNV
  3888. '' SIG '' BAsTIkNvcHlyaWdodCAoYykgMTk5NyBNaWNyb3NvZnQg
  3889. '' SIG '' Q29ycC4xHjAcBgNVBAsTFU1pY3Jvc29mdCBDb3Jwb3Jh
  3890. '' SIG '' dGlvbjEhMB8GA1UEAxMYTWljcm9zb2Z0IFJvb3QgQXV0
  3891. '' SIG '' aG9yaXR5ghBqC5lPwADeqhHU2ECaqL7mMEoGA1UdHwRD
  3892. '' SIG '' MEEwP6A9oDuGOWh0dHA6Ly9jcmwubWljcm9zb2Z0LmNv
  3893. '' SIG '' bS9wa2kvY3JsL3Byb2R1Y3RzL0NvZGVTaWduUENBLmNy
  3894. '' SIG '' bDANBgkqhkiG9w0BAQUFAAOCAQEANSP9E1T86dzw3QwU
  3895. '' SIG '' evqns879pzrIuuXn9gP7U9unmamgmzacA+uCRxwhvRTL
  3896. '' SIG '' 52dACccWkQJVzkNCtM0bXbDzMgQ9EuUdpwenj6N+RVV2
  3897. '' SIG '' G5aVkWnw3TjzSInvcEC327VVgMADxC62KNwKgg7HQ+N6
  3898. '' SIG '' SF24BomSQGxuxdz4mu8LviEKjC86te2nznGHaCPhs+QY
  3899. '' SIG '' fbhHAaUrxFjLsolsX/3TLMRvuCOyDf888hFFdPIJBpkY
  3900. '' SIG '' 3W/AhgEYEh0rFq9W72UzoepnTvRLgqvpD9wB+t9gf2ZH
  3901. '' SIG '' XcsscMx7TtkGuG6MDP5iHkL5k3yiqwqe0CMQrk17J5Fv
  3902. '' SIG '' Jr5o+qY/nyPryJ27hzGCBN0wggTZAgEBMIG1MIGmMQsw
  3903. '' SIG '' CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQ
  3904. '' SIG '' MA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9z
  3905. '' SIG '' b2Z0IENvcnBvcmF0aW9uMSswKQYDVQQLEyJDb3B5cmln
  3906. '' SIG '' aHQgKGMpIDIwMDAgTWljcm9zb2Z0IENvcnAuMSMwIQYD
  3907. '' SIG '' VQQDExpNaWNyb3NvZnQgQ29kZSBTaWduaW5nIFBDQQIK
  3908. '' SIG '' YQcRQwAAAAAANDAMBggqhkiG9w0CBQUAoIGqMBkGCSqG
  3909. '' SIG '' SIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcC
  3910. '' SIG '' AQsxDjAMBgorBgEEAYI3AgEVMB8GCSqGSIb3DQEJBDES
  3911. '' SIG '' BBAZBnnYm2gRb/lDE2fqJ+IWME4GCisGAQQBgjcCAQwx
  3912. '' SIG '' QDA+oCaAJABwAGEAZwBlAGYAaQBsAGUAYwBvAG4AZgBp
  3913. '' SIG '' AGcALgB2AGIAc6EUgBJ3d3cubWljcm9zb2Z0LmNvbSAw
  3914. '' SIG '' DQYJKoZIhvcNAQEBBQAEggEAVrY7HUIi4Emzwy+RpCJA
  3915. '' SIG '' pVRYEi7yH9RDTWX+kPe/wdJpJpae9X7j4wU+C2oIywCF
  3916. '' SIG '' wCqxcE1HwYJu5MR4DV6EAcXJHs/eEuqU2qeMJh1zOmvy
  3917. '' SIG '' vFbVgTpsFcGSMOXvTRXjeTHSQFGfuP1FhU90ENIYrK/k
  3918. '' SIG '' RXUPH16d6rGQ8nBQUGi8uxzLOA94YXGfufMznaTCe6/z
  3919. '' SIG '' WLFioxEv9lpbaxIcnQjKXHCsnQLM557p1wGtb6/TtZuN
  3920. '' SIG '' veQbz6fcgJOZxLIk1B9Ffy90sO+YAvK6vgValTEZ1EFV
  3921. '' SIG '' lPBP13vTgdFH9ALo4BSeDKOHn8pxf3zW3+ZFJNQPRl7A
  3922. '' SIG '' o0fXKB0T5ni10KGCAkwwggJIBgkqhkiG9w0BCQYxggI5
  3923. '' SIG '' MIICNQIBATCBszCBnjEfMB0GA1UEChMWVmVyaVNpZ24g
  3924. '' SIG '' VHJ1c3QgTmV0d29yazEXMBUGA1UECxMOVmVyaVNpZ24s
  3925. '' SIG '' IEluYy4xLDAqBgNVBAsTI1ZlcmlTaWduIFRpbWUgU3Rh
  3926. '' SIG '' bXBpbmcgU2VydmljZSBSb290MTQwMgYDVQQLEytOTyBM
  3927. '' SIG '' SUFCSUxJVFkgQUNDRVBURUQsIChjKTk3IFZlcmlTaWdu
  3928. '' SIG '' LCBJbmMuAhAIem1cb2KTT7rE/UPhFBidMAwGCCqGSIb3
  3929. '' SIG '' DQIFBQCgWTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcB
  3930. '' SIG '' MBwGCSqGSIb3DQEJBTEPFw0wMjEwMzAwMDE1NDdaMB8G
  3931. '' SIG '' CSqGSIb3DQEJBDESBBAeS2yNHwLSVyiXAZeQB+I2MA0G
  3932. '' SIG '' CSqGSIb3DQEBAQUABIIBAKffznG7CddPvTyv8VFLP8CJ
  3933. '' SIG '' KknWy7Jp8LJnptz+QdfY0ywUNxcjt5N2lBSy+Q6t93bz
  3934. '' SIG '' i6w6qQ6B3eZK7KtF2s0kWzSebRm9Mw0bcOxLWKz2FnuN
  3935. '' SIG '' BwhQp+CpJbKf6egJaqWfgbo7ULkrZhM9LqiBZE7OqLTn
  3936. '' SIG '' bRo22pHAgTEIo3wzO6ul203i98aJ1HMM42xKuqgFEe/9
  3937. '' SIG '' 6qDnWEvZZu/UpH7jU4PogKEZxH1EQrahyaVxHAwg6J1X
  3938. '' SIG '' uh55iLbkcXoKLJ19E/djijoX9qUnFp7Vccw6VebJU7QR
  3939. '' SIG '' eX4R20WeD9v/7C4K+VngvBiawLQf8p+FYya6uyIbg6Yt
  3940. '' SIG '' 7gGQq8NPq1M=
  3941. '' SIG '' End signature block
  3942.